ListView Checkbox

vellaima

Centurion
Joined
Jan 29, 2003
Messages
109
I have set the checkboxes for ListView to true. During run time whenever the user clicks each checkbox i would like to get the status of the particular checkbox. Can this be done. Please Help.
 
The ListView has an ItemCheck event which should trigger every time a checkbox is checked or cleared. You can then see whether it is checked using e.CurrentValue.
 
Visual Basic:
    Private Sub ListView1_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles ListView1.ItemCheck
        Dim l As ListViewItem
        Dim s As String = ""

        For Each l In ListView1.CheckedItems
            'Do whatever you like with this item
            If s.Length = 0 Then s &= l.Text Else s &= "," & l.Text
        Next
    End Sub
 
I would like to select only one item and store it in string array. The ListView as Multiple columns. Can you please provide me with a code.
 
Back
Top