Combo Box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Slaxer13
    New Member
    • Jun 2014
    • 106

    #1

    Combo Box

    Hi ppl.

    How do i make a combo box have its fields defined by the value of another combo box?

    For exemple if in the first combo box the chosen field is "Soccer" then the values of the other combo box will be "Referee, Player, Ball". If the first combo box chosen field is "Money" then the other combo box values will be "Coin, Payment".

    Appreciate any help,
    Cheers. Slaxer13
  • Luk3r
    Contributor
    • Jan 2014
    • 300

    #2
    I think the most obvious and simple answer would be something like this:
    Code:
            If ComboBox1.Text.ToLower = "sports" Then
                ComboBox2.Items.AddRange({"Football", "Baseball", "Hockey"})
            ElseIf ComboBox1.Text.ToLower = "cars" Then
                ComboBox2.Items.AddRange({"Mustang", "Camaro", "Charger"})
            ElseIf ComboBox1.Text.ToLower = "beverages" Then
                ComboBox2.Items.AddRange({"Water", "Soda", "Alcohol"})
            End If

    Edit**: You would obviously want to clear your ComboBox2 with an action. In my case, I actually cleared it on SelectedIndexCh anged event. Hope this helps.

    Comment

    • Slaxer13
      New Member
      • Jun 2014
      • 106

      #3
      Thank you Luk3r. It solved my problem.
      Cheers.
      Slaxer13

      Comment

      Working...