Listview.. get clicked item.

P

Pat

I downloaded all of the Newsgroup and did a find.. didn't see answer..
How do you find which item is clicked on, with a Listview.

..SelectedIndexCollection or .SelectedIndices looked like a light at the
end of the tunnel but I cant seem to get
this puppy to work for me.

help please I wasted a lot of time on this.. to the point where I will write
my own user-drawn to get past this.
hmph!

-Pat (Ashmed to put name to this as I know the solution is !SO! simple)
Thanks
 
D

Daniel Moth

mListView.Items(mListView.SelectedIndices(0))

but check the Selectedindices count>0 first

Cheers
Daniel
 
P

Pat

Great! it worked.. thanks Daniel..

To complete this thread here is the code..

Private Sub LSV_ItemActivate(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LSV.ItemActivate

If LSV.SelectedIndices.Count > 0 Then

Dim LI As ListViewItem = LSV.Items(LSV.SelectedIndices(0))
MsgBox(LI.Text)

End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top