accessing ListBox's SelectedItem will return the currently selected item. There's also SelectedIndex, which will return the list index of currently selected item. If it returns -1, no item is selected.
Andrej
Andrej Tozon Monday, October 23, 2006 7:05 AM
You can use the ListBox.SelectedItem property to retrieve the selected item. This is null when no item was selected. Here is a little example:
Pieter Joost van de Sande Monday, October 23, 2006 7:07 AM
Hi,
accessing ListBox's SelectedItem will return the currently selected item. There's also SelectedIndex, which will return the list index of currently selected item. If it returns -1, no item is selected.
Andrej
Andrej Tozon Monday, October 23, 2006 7:05 AM
ListBox1.SelectedItem.ToString() this will return the selected item in the list box.
Prasant Swain Monday, October 23, 2006 7:06 AM
You can use the ListBox.SelectedItem property to retrieve the selected item. This is null when no item was selected. Here is a little example: