This control combines the features of a text box and a list box, enabling the user to select an item either by typing text into the combo box or by selecting it from the list.
ComboBox
The ComboBox control supports the following properties:
The ComboBox control supports the following methods:
AddItem | RemoveItem |
Clear (Clipboard, ComboBox, ListBox) | SetFocus |
Move | ZOrder |
Refresh |
The ComboBox control supports the following events:
Change | KeyDown |
Click | KeyPress |
DblClick | KeyUp |
DropDown | LostFocus |
GotFocus | Scroll |
Combo boxes present a list of choices to the user. If the number of items exceeds what can be displayed in the combo box, scroll bars automatically appear on the control.
Combo boxes come in three styles that you can set during design or run time. The following table shows the values you can use to set the style of the combo box.
Style |
Value |
Drop-down Combo Box | 0 |
Simple Combo Box | 1 |
Drop-down List Box | 2 |
To add or delete items in a ComboBox control, use the AddItem or RemoveItem method. Set the List, ListCount, and ListIndex properties to enable a user to access items in the ComboBox. Alternatively, you can add items to the list by using the List property at design time.