As you know by question that what I want. I was using listbox. In ListBox
we can get selected item by a simple line of code:
listbox1.SelectedItem
. Now I am using ListView
, how I get the SelectedItem
or SelectedIndex
of ListView
.
You can access all items that are selected in a ListView control by using the ListView. SelectedItems property.
You can use ListView1. Items. Insert(index, ListViewItem) to add the new item to the specific position.
The ListView control is used to display a list of items. Along with the TreeView control, it allows you to create a Windows Explorer like interface. Let's click on a ListView control from the Toolbox and place it on the form. The ListView control displays a list of items along with icons.
VB6:
Listview1.selecteditem
VB10:
Listview1.FocusedItem.Text
Here's the answer that I found for my question:
urlList1.FocusedItem.Index
And I am getting selected item value by:
urlList1.Items(urlList1.FocusedItem.Index).SubItems(0).Text
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With