Creates a combo box, which initially displays a single item. However, when you select the combo box, it displays a list of items that you can choose an item from. A combo box combines the features of a text box and a list box. You can enter information in the text box portion or select an item from the list box portion of the control.
|The Style property determines the type of list that the ComboBox control contains. To create a drop-down combo box, which displays a drop-down list and edit box, set the Style property to 0. To create a drop-list box, which displays a drop-down list only, set the Style property to 2.
To show or hide the list in a combo box, select the control and press ALT+DOWN ARROW.
The following table lists properties commonly set at design time.
Determines the number of columns in the list.
Specifies where to store the value that the user chooses from the list.
Specifies whether to display mover bars to the left of the items in the list so that a user can rearrange the item order.
Specifies whether the user can select more than one item in the list.
Specifies the source of the values displayed in the list.
Specifies the type of the source of the values displayed in the list.
The following table lists methods commonly used.
Adds an item to the list when RowSourceType is set to 0.
Removes an item from the list when RowSourceType is set to 0.
Updates the list if the values in the source specified by RowSource have changed.
The backslash ("\") is treated as a special character when used in the expression for an item. The following rules apply for this character
You can disable an item in a list box or combo box by adding a single backslash to the beginning of the expression.
Any multiple of two backslashes used in the expression is displayed as a single backslash. For example, one or two backslashes used together display as one, and three or four backslashes together display as two. The following example code contains a list box item containing a Universal Naming Convention (UNC) path. The code displays in the list box as
В Copy Code
If the expression begins with multiple backslashes, the item is not disabled. If you want to disable an item that begins with multiple backslashes, add a backslash and a close bracket (]) to the beginning of the item. For example, the following would disable the UNC path item in the list box.
В Copy Code
To include a separator line use a backslash followed by a hyphen as the item to add to the list box. For example, the following code adds a separator line to a list box.
В Copy Code
You can also use an ActiveX control that adds extra characteristics, such as a Checkbox control, to the ListView or TreeView controls.