ComboBox Selection

VbStudent302

Newcomer
Joined
Oct 27, 2004
Messages
7
If i have a combo box with the values 1,2,3 & 4 in it and i have a button, how would i get the button to when pressed turn the combobox's selected item to 2?
 
If you wish to select the item with the text "2" you can use

Visual Basic:
ComboBox1.SelectedIndex = ComboBox1.Items.IndexOf("2")

or if you wish to select the second item regardless of what it is

Visual Basic:
ComboBox1.SelectedIndex = 1
 
Back
Top