Selected Row ListView

S

samoore33

I have gotten my ListView populated, almost broke my arm patting myself
on the back. Now I am not able to find out how to return information
from a row that has been selected. I have searched and searched, this
link seems to have somethings that should help me:
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21891615.html
But when I try using ListView1.SelectedItems(0).Item(0).Text, I get an
error of Specified argument was out of the range of valid values.

I have the properties of the ListView set:
lsvTest.CheckBoxes = True
lsvTest.FullRowSelect = True
lsvTest.GridLines = True

Any help would be appreciated, thankfully I am already bald so that I
am not pulling my hair out over this.

Scott Moore
 
G

gene kelley

I have gotten my ListView populated, almost broke my arm patting myself
on the back. Now I am not able to find out how to return information
from a row that has been selected. I have searched and searched, this
link seems to have somethings that should help me:
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21891615.html
But when I try using ListView1.SelectedItems(0).Item(0).Text, I get an
error of Specified argument was out of the range of valid values.

I have the properties of the ListView set:
lsvTest.CheckBoxes = True
lsvTest.FullRowSelect = True
lsvTest.GridLines = True

Any help would be appreciated, thankfully I am already bald so that I
am not pulling my hair out over this.

Scott Moore

A populated ListView Row consists of n number of Item.SubItems:

Private Sub Listview1_ItemSelectionChanged(ByVal sender As Object, ByVal e As _
System.Windows.Forms.ListViewItemSelectionChangedEventArgs) Handles Listview1.ItemSelectionChanged

Dim MyFirstItem As String = e.Item.SubItems(0).Text
Dim MyNextItem As String = e.Item.SubItems(1).Text

End Sub

Gene
 

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