ComboBox Control

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.

Syntax

ComboBox

The ComboBox control supports the following properties:

Appearance HWnd SelText
BackColor IntegralHeight Sorted
Container ItemData Style
Enabled Left TabIndex
Font List TabStop
FontBold ListCount Tag
FontItalic ListIndex Text
FontStrikethru Locked Top
FontUnderline Name TopIndex
FontName NewIndex Width
FontSize Parent  
ForeColor SelLength Visible
Height SelStart  

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

Remarks

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.