ListView Get Subitemvalues

Scorpi

Newcomer
Joined
Dec 16, 2003
Messages
1
Location
Germany
Hi ,

i have a Listview with "x" of rows. I want to get the value of the current selected row of the subitem in Column 2. I want not only one time the value, because it is possible, that someone goes down the list and wish to get this value more times

How can i recive this value not only one time?

Sorry about my bad english

Scorpi
 
like this .....
Visual Basic:
        Dim indexOfItem As Integer = 0 '/// your main listitem's index would go here.
        Dim indexOfSubitem As Integer = 1 '/// subitem's index here , eg: 1 is the first subitem ( next column to main item )
        MessageBox.Show(ListView1.Items(indexOfItem).SubItems(indexOfSubitem).Text)
hopefully i've explained that clear enough. hope it helps :)
 
dynamic_sysop, I think he's refering to a user selected line in the listview

Visual Basic:
    Private Sub ListView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Listview1.SelectedIndexChanged
        For i = 0 To ListView1.Items.Count - 1
            If ListView1.Items(i).Selected Then
                MessageBox.Show(ListView1.Items(i).SubItems(1).Text)
            End If
        Next
End Sub

I'm assuming that you know how to unselect the selected listview line.
 
this is true , but i was trying to give them a better understanding of how the listview item / subitems get returned :) , hence being able to put a description of each one next to an integer. ;)
 
Back
Top