Style Property (ComboBox)

Purpose

Returns or sets a value indicating the display type and behavior of the control.

Syntax

Object.Style [ = value% ]

Object:ComboBox

Description

The Style property settings for the ComboBox control are:

Value Description

0 (Default) Dropdown Combo. Includes a drop-down list and a text box. The user can select from the list or type in the text box.

1 Simple Combo. 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.

2 Dropdown List. This style allows selection only from the drop-down list.

Example

Local a$, n As Int32

Ocx ComboBox cb1 = "", 10, 10, 150, 22 : .Style = 0

Ocx ComboBox cb2 = "", 200, 10, 150, 150 : .Style = 1 : cb2.Height = 10 * TextHeight("A")

Ocx ComboBox cb3 = "", 390, 10, 150, 22 : .Style = 2

For n = 1 To 20 : a$ = "Item " & Format(n, "00")

cb1.AddItem a$

cb2.AddItem a$

cb3.AddItem a$

Next n

Do : Sleep : Until Me Is Nothing

Remarks

Use setting 0 (Dropdown Combo) or setting 1 (Simple Combo) to give the user a list of choices. Either style enables the user to enter a choice in the text box. Setting 0 saves space on the form because the list portion closes when the user selects an item.

Use setting 2 (Dropdown List) to display a fixed list of choices from which the user can select one. The list portion closes when the user selects an item.

See Also

ComboBox

{Created by Sjouke Hamstra; Last updated: 23/10/2014 by James Gaite}