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.
Private Sub ListView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.Click
Dim tt As String
tt = ListView1.SelectedItems.Item(0).SubItems(1).Text
TextBox1.Text = tt.ToString
End Sub
Please Try This for Getting column Index
Private Sub lvDetail_MouseMove(sender As Object, e As MouseEventArgs) Handles lvDetail.MouseClick
Dim info As ListViewHitTestInfo = lvDetail.HitTest(e.X, e.Y)
Dim rowIndex As Integer = lvDetail.FocusedItem.Index
lvDetail.Items(rowIndex).Selected = True
Dim xTxt = info.SubItem.Text
For i = 0 To lvDetail.Columns.Count - 1
If lvDetail.SelectedItems(0).SubItems(i).Text = xTxt Then
MsgBox(i)
End If
Next
End Sub
If you want to select the same item in a listbox using a listview, you can use:
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
For aa As Integer = 0 To ListView1.SelectedItems.Count - 1
ListBox1.SelectedIndex = ListView1.SelectedIndices(aa)
Next
End Sub
ListView returns collections of selected items and indices through the SelectedItems and SelectedIndices properties. Note that these collections are empty, if no item is currently selected (lst.SelectedItems.Count = 0). The first item that is selected is lst.SelectedItems(0). The index of this item in the Items collection is lst.SelectedIndices(0). So basically
lst.SelectedItems(0)
is the same as
lst.Items(lst.SelectedIndices(0))
You can also use check boxes. Set CheckBoxes to True for this. Through the CheckedItems and CheckedIndices properties you can see which items are checked.
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
VB6:
Listview1.selecteditem
VB10:
Listview1.FocusedItem.Text