Home All Groups Group Topic Archive Search About

Selected Row ListView

Author
8 Sep 2006 4:34 PM
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

Author
8 Sep 2006 8:10 PM
gene kelley
Show quote Hide quote
On 8 Sep 2006 09:34:45 -0700, "samoore33" <samoor***@gmail.com> wrote:

>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