ComboBox Control

Creates a combo box.

ComboBox

Remarks

When selected, the ComboBox control opens, displaying a list of items from which you can choose one. A ComboBox control combines the features of a TextBox control and a ListBox control. You can enter information in the text box portion or select an item from the list box portion of the control.

Note   You can show or hide the item list of a ComboBox control by pressing Alt+Down Arrow when the control is selected.

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 \\MyServer\MyMachine\MyFolder.

    MyForm.List1.AddItem("\\\\MyServer\\MyMachine\\MyFolder")
    
  • 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.

    MyForm.List1.AddItem("\]\\\MyServer\\MyMachine\\MyFolder")
    
  • 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.

    MyForm.List1.AddItem("\-")
    

The Style property determines the ComboBox control type. If the Style property is set to 0, a drop-down ComboBox control is created. If the Style property is set to 2, a drop-down list box is created.

You can also use an ActiveX control that adds extra characteristics, such as a checkbox to the listview or treeview controls.

For additional information about ComboBox controls, see Form Designer and Using Controls.

See Also

ComboBox Control Properties, Methods and Events | CREATE CLASS | CREATE FORM | DEFINE CLASS