How to select the first item of a DropDownList Combobox
I have a combo box with four lines of data:
Code:
Reina Beatrix Arpt, Aruba, AW (AUA)
Grantley Adams Intl Arpt, Barbados, BB (BGI)
Owen Roberts Arpt, Grand Cayman Island, KY (GCM)
Miami Intl, Miami, FL (MIA)
Cyril E King Arpt, St Thomas, VI (STT)
I want to write a program where I select the first item of a DropDownList Combo box (or the second, third, forth, and fifth item) and write an if... end if statement to specify a certain condition.
This doesn't work
Code:
If Combobox1.Items.Items(0) Then
TextBox1.Text = ....
End if
Thank you!
Re: How to select the first item of a DropDownList Combobox
use the selectedindex, + selecteditem, or text properties of your combobox
the selectedindex ranges from -1 (no item selected) to items.count -1 (the last item)
the text is what is displayed in the non dropdown part of your combobox