I have a listbox (detailed view). How do I get the index of the selected item?
I also eventually want to get the text at the index, but that should be easy.
I have a listbox (detailed view). How do I get the index of the selected item?
I also eventually want to get the text at the index, but that should be easy.
I think you mean ListView (not ListBox) so use SelectedItems and SelectedIndices properties.
The selected index is in the
SelectedIndex
property.The selected text is in the
Text
property.ListBox.SelectedItem Property:
Or, naturally, ListBox.SelectedItems Propery: