property ComboBox.Items as Items

Retrieves the control's item collection.

TypeDescription
Items An Items object that holds the control's items collection.

Use Items property to access the control's items collection. Use the Add method to add new columns to the control. Use the AddItem, InsertItem, PutItems method to to add new items to the control. Use the GetItems method to get the items collection into a safe array. Stores the Items property to a member variable, if you are using Items property multiple times, to maintain performance. Use the BeginUpdate and EndUpdate to avoid updating the control while adding new items and columns to the control.

For instance, the following VB sample shows how to hold the Items property to a member variable:

For i = 0 To 100
    ComboBox1.Items.AddItem "1"
    ComboBox1.Items.AddItem "2"
Next

The following VB sample shows how to hold the Items property to a member variable:

Dim its As Items
Set its = ComboBox1.Items
For i = 0 To 100
    its.AddItem "1"
    its.AddItem "2"
Next

The following VB sample shows how to use the Items property to add a column and some items to a drop down list control:

With ComboBox1.Items
    For i = 0 To 100
        .AddItem "1"
        .AddItem "2"
    Next
End With

as well.

The following VB sample adds a column and some items to a drop down list control:

With ComboBox1
    .BeginUpdate
    .Style = DropDownList
    .ColumnAutoResize = True
    .Columns.Add "Column 1"
    .PutItems Array(1, "Item 2", 3, 4, 5)
    .Items.SelectItem(.Items.FindItem("Item 2")) = True
    .EndUpdate
End With

The following C++ gets the Items collection to a member variable:

CItems its = m_combobox.GetItems();

The following VB.NET gets the Items collection to a member variable:

Dim its As EXCOMBOBOXLib.Items = AxComboBox1.Items

The following VB.NET sample shows how to use the Items property to add a column and some items to a drop down list control:

With AxComboBox1.Items

End With

The following C# gets the Items collection to a member variable:

EXCOMBOBOXLib.Items its = axComboBox1.Items;

The following VFP gets the Items collection to a member variable:

With thisform.ComboBox1
EndWith

The following VFP sample shows how to store the Items property to a member variable:

local its
its = thisform.ComboBox1