1 Attachment(s)
select list from the listview
I have the listview. I would like to display the filename and the path location in the textbox when I select the list from the listview. Any idea? Just want to learn how I can read the list items from listview and show it in the 2 textbox.Have a sample to test with ?
text1.text = filename
text2.text = path location.
Code:
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems.Item(i).Selected Then
'what should I do
End If
Next i
Re: select list from the listview
If you ask to pass to textbox value from the second column then it's a subitem.
You may want to set Multiline = True for your textbox before running this:
Code:
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems.Item(i).Selected Then
Text2.Text = Text2.Text & ListView1.ListItems.Item(i).Subitems(1) & vbNewLine
End If
Next i
Re: select list from the listview
Why when I click anywhere in the listview,it show me the path location in the textbox. The textbox should show the path location only selected item. I put my code in the click event.
Private Sub ListView1_Click()
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems.Item(i).Selected Then
Text2.Text = ListView1.ListItems.Item(i).Subitems(1) & vbNewLine
End If
Next i