ListBox.Column Property
Access Developer Reference |
You can use the Column property to refer to a specific column, or column and row combination, in a multiple-column combo box or list box. Read-only Variant.
Syntax
expression.Column(Index, Row)
expression A variable that represents a ListBox object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Index | Required | Long | A long integer that can range from 0 to the setting of the ColumnCount property minus one. |
Row | Optional | Variant | An integer that can range from 0 to the setting of the ListCount property minus 1. |
Remarks
Use 0 to refer to the first column, 1 to refer to the second column, and so on. Use 0 to refer to the first row, 1 to refer to the second row, and so on. For example, in a list box containing a column of customer IDs and a column of customer names, you could refer to the customer name in the second column and fifth row as:
Visual Basic for Applications |
---|
|
You can use the Column property to assign the contents of a combo box or list box to another control, such as a text box. For example, to set the ControlSource property of a text box to the value in the second column of a list box, you could use the following expression:
Visual Basic for Applications |
---|
|
If the user has made no selection when you refer to a column in a combo box or list box, the Column property setting will be Null. You can use the IsNull function to determine if a selection has been made, as in the following example:
Visual Basic for Applications |
---|
|
Note |
---|
To determine how many columns a combo box or list box has, you can inspect the ColumnCount property setting. |
Example
The following example uses the Column property and the ColumnCount property to print the values of a list box selection.
Visual Basic for Applications |
---|
|