visual basic combo boxes

Discussion in 'Web Design & Coding' started by Kush, Dec 30, 2003.

  1. Kush

    Kush High On Life!

    Messages:
    4,590
    Location:
    Montreal, Quebec
    hi guys i need help with something that might be simple to u.
    i have two combo boxes the ones that u can add at runtime, and i have two options in each one for say bob and cob, i want to have if the user selects bob in the first combo box he cant select bob in the second one, therefore he would have to select cob, i tried doing it by adding and removing from the list but it messes up and adds to much of one or removes one thing, i also tried to do it if blahblah.text = bob then blahblah2.text >< bob. doesnt work that way either. thanks for your help.
     
  2. sboulema

    sboulema Moderator

    Messages:
    2,846
    Location:
    Amstelveen, The Netherlands
    put two combo boxes in a form and use this code;

    Code:
    Private Sub Combo1_Click()
    If Combo1.Text = "bob" Then
    Combo2.Clear
    Combo2.AddItem "cob"
    End If
    
    If Combo1.Text = "cob" Then
    Combo2.Clear
    Combo2.AddItem "bob"
    End If
    End Sub
    
    Private Sub Form_Load()
    Combo1.AddItem "bob"
    Combo1.AddItem "cob"
    Combo2.AddItem "bob"
    Combo2.AddItem "cob"
    End Sub
    is this what you are looking for?
     
  3. Kush

    Kush High On Life!

    Messages:
    4,590
    Location:
    Montreal, Quebec
    yeah i think so. ill try it when i get home, thanks alot
     
  4. Kush

    Kush High On Life!

    Messages:
    4,590
    Location:
    Montreal, Quebec
    yeah thats what i wanted, thanks alot man