Obtains the text of an item in a ListBox control.
ListBox, DropDownListBox, PictureListBox, and DropDownPictureListBox controls
listboxname.Text ( index )
Argument |
Description |
---|---|
listboxname |
The name of the ListBox control in which you want the text of an item |
index |
The number of the item for which you want the text |
String. Returns the text of the item in listboxname identified by index. If the index does not point to a valid item number, Text returns the empty string (“”). If any argument’s value is null, Text returns null.
Assume the ListBox lb_Cities contains:
Atlanta
Boston
Chicago
Denver
Then these statements store the text of item 3, which is Chicago, in current_city:
string current_city
current_city = lb_Cities.Text(3)