JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Creating Simple Combo Boxes, Drop-down Combo Boxes, and Drop-down List Combo Boxes

You might think there is only one kind of combo box, but there are really three types. You select which type you want with the combo box's DropDownStyle (formerly Style) property.

The default type of combo box is probably what you think of when you think of combo boxes, because it is made up of a text box and a drop-down list. However, you also can have combo boxes where the list doesn't drop down (the list is always open, and you have to make sure to provide space for it when you add the combo box to your form), and combo boxes where the user only can select from the list. Here are the settings for the combo box DropDownStyle property- these are members of the ComboBoxStyle enumeration:

  • DropDown (the default)-Includes a drop-down list and a text box. The user can select from the list or type in the text box.

  • Simple-Includes a text box and a list, which doesn't drop down. The user can select from the list or type in the text box. The size of a simple combo box includes both the edit and list portions. By default, a simple combo box is sized so that none of the list is displayed. Increase the Height property to display more of the list.

  • DropDownList-This style allows selection only from the drop-down list. This is a good one to keep in mind when you want to restrict the user's input, but if you want to use this one, you also should consider simple list boxes.

You can see a drop-down combo box in the ComboBoxes example on the CD-ROM, and you can see that example at work in Figure 7.3.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor