Partilhar via


ListItem Property

A character string array used to access the items in a ComboBox or ListBox control by item ID. Not available at design time; read-write at run time.

Control.ListItem(nRow [, nCol])[ = cChar]

Property Values

  • nRow
    Specifies the row from which to retrieve the item. You can use the control.listitemID property.
  • nCol
    Specifies, optionally, the column from which to derive the value. If you specify only listitemID column one provides the value.
  • nChar
    Represents a value, optionally, to be assigned to the specified Control.listitem.

Remarks

The ListItem property works in conjunction with the ListCount property; enumerating a list from 1 to ListCount returns all items in the list. Use the List property to retrieve items in the order they are displayed; use the ListItem property to retrieve items according to their item ID.

Note   To add items to a combo box or list box, use the AddItem or AddListItem method. To remove items, use the RemovetItem method or the RemoveListItem method. To keep items in alphabetic order, set the control's Sorted property to true (.T.) before adding items to the list.

The ListItem property is also set when the Selected property on a Listbox control is set.

See Also

AddItem Method | AddListItem Method | IndexToItemID Method | ItemIDToIndex Method | ListCount Property | List Property | ListItemID Property | Selected Property

Applies To: ComboBox | ListBox