JavaScript Editor js editor     Web development 

Main Page

The combo box control has the functionality of a list box and a text box. There are two styles for a combo box: Drop-down combo and Drop-down list. Specify which one you want by changing the Style property of the control. Drop-down lists are discussed in Controls for Displaying Lists.

Drop-Down Combo Box

A user can click the button on a drop-down combo box to see a list of choices or enter a new item directly in the box beside the button. The default Style property of a combo box is 0 — Dropdown Combo.

Adding User Items to Drop-Down Combo Box Lists

To add the new user value to the drop-down combo box, you can use the following line of code in the method associated with the Valid event of the combo box:

В Copy Code

Before adding an item, however, it would be a good idea to check to make sure that the value is not already in the combo box drop-down:

В Copy Code
lItemExists = .F. && assume the value isn't in the list.
FOR i = 1 to THIS.ListCount
   IF THIS.List(i) = THIS.Text
      lItemExists = .T.

IF !lItemExists

Common Combo Box Properties

The following combo box properties are commonly set at design time.

Property Description


Specifies the table field where the value that the user chooses or enters is stored.


Specifies the maximum number of items displayed in the list.


For drop-down combo boxes, specifies the type of values that can be typed in.


Specifies whether the control tries to match an item in the list as the user types each letter.


Specifies the source of the items in the combo box.


Specifies the type of the source for the combo box. The RowSourceType values for a combo box are the same as for a List.


Specifies whether the combo box is a drop-down combo or a drop-down list.

See Also

JavaScript Editor js editor     Web development