title | keywords | f1_keywords | ms.assetid | ms.date | ms.localizationpriority | |
---|---|---|---|---|---|---|
How to: Add Items To a List or Combo Box at Run Time |
olfm10.chm3077344 |
|
5dd25eb3-8c36-3e71-30ae-b35638ef6943 |
06/08/2019 |
medium |
In a ListBox or ComboBox with a single column, use the AddItem method to add an individual entry to the list.
In a multicolumn list box or combo box, you can use the List and Column properties to load the list from a two-dimensional array, as shown in the following steps.
-
Create a multicolumn ListBox or ComboBox control.
-
In VBScript, create a two-dimensional array that contains the items you want to put in the list.
-
Set the ColumnCount property of the list box or combo box to match the number of entries in the list. To set the property, click the property and enter a value in the Apply box.
-
Do one of the following:
- Assign the array as the value of the List property. The contents of the list box will match the contents of the array exactly.
- Assign the array as the value of the Column property. Column transposes rows and columns, so each row of the list box matches the corresponding column of the array.
[!includeSupport and feedback]