Results 1 to 2 of 2

Thread: How do you get the selected index in listview ?

  1. #1
    egiggey
    Guest
    like this

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ListView1.View = View.List
    Dim i As Integer
    For i = 0 To 300
    ListView1.Items.Add(i.ToString)
    Next i
    End Sub

    Private Sub ListView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.Click
    MessageBox.Show(ListView1.FocusedItem.Index.ToString)
    End Sub

    I had to experiment a little but this pops up a message box with the index number of the item you click on.

    hope this helps

  2. #2
    Addicted Member
    Join Date
    Dec 2001
    Location
    Guess....i have wooden shoes, in my free time i sell tulips and I live in a huge windmill...
    Posts
    176
    when the Listview isn't Multiselect this gives me an error...
    JpEgy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width