text of listview

  • Thread starter Thread starter Maarten
  • Start date Start date
M

Maarten

how can i retrieve the text of an item(first column) in a listview
when i check the checkbox.
the index is no problem, but the text isn't.

thanks Maarten
 
Maarten said:
how can i retrieve the text of an item(first column) in a listview
when i check the checkbox.
the index is no problem, but the text isn't.

'Me.ListView1.Items(<Index>).Text'.
 
I did not test this, but it should work:

Private Sub ListView1_ItemCheck(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ItemCheckEventArgs) Handles ListView1.ItemCheck
If e.CurrentValue = CheckState.Checked Then
Dim lvi As ListViewItem = ListView1.Items(e.Index)
Dim FirstCol As ListViewItem.ListViewSubItem = lvi.SubItems(0)
Dim s As String = FirstCol.Text
messagebox.show(s)
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

Back
Top