ComboBox                                                                Object

ADDOBJECT "ComboBox", name, xpos, ypos, width, height

Description

ComboBox is used to display a drop-down list object with an entry line that floats over the output window. The required component, name, is the name of a variable that is added to the program to reference the object, it must follow standard variable naming conventions. The required components, xpos, ypos, width, and height are numeric expressions that set the location and expanded size of the object in pixels, measured from the upper left corner. The Text and Caption properties hold the value of the entry line of the object. The ListIndex property is the index of the entry line in the list, the index of the first item is 0; if the entry line text doesn't match one of the list items, the ListIndex property is -1. Be sure to set the height of the object to its expanded size: at runtime it will be a single line until it is expanded.

Properties Supported (see "Properties")

BackColor, Caption, Enabled,  ExpandedHeight (read only), FontBold, FontItalic, FontName, FontSize, FontStrikethru, FontUnderline, Forecolor, Height, Hwnd, IntegralHeight, Left, list (read only), ListCount (read-only), ListIndex, LowercaseOnly, Name, NewIndex, ParentHWnd, Redraw, Sorted, Style, TabStop, Tag, Text, Timer, Top, TopIndex, UppercaseOnly, Visible, Width, WindowLong

Methods Supported (see "Methods")

AddItem, Clear, Hide, Move, RemoveItem, SetFocus, Show

Events Supported (see "Events")

Change, Click, DropDown, GotFocus, KeyDown, KeyPress, KeyUp, LostFocus, Timer

Example

REM ComboBox is a drop-down list object

DIM i

ADDOBJECT "ComboBox","Combo", 5, 5, 100, 200

Combo.Style = 2

FOR i = vbSUNDAY TO vbSATURDAY

  Combo.AddItem WEEKDAYNAME(i)

NEXT

Combo.ListIndex = WEEKDAY(NOW-1)

PRINT Combo.List(Combo.ListIndex)

Output

Related Items

ADDOBJECT, Events, ListBox, Methods, Properties