This is my ListView, Column 1 for ID and Column 2 for Notes
I have a Multi-Line textbox and a Butt开发者_开发百科on Like this
I want to load the selected note on the textbox when the button is clicked. How can I do this ?
You can try something similar to this (you'll have to tweak it for your setup)
If listView.SelectedItems.Count > 0 Then
textBox.Text = listView.SelectedItems(0).SubItems(1).Text
End If
if you don't like the idea of using column index and if you have your columns setup right then you should be able to do .SubItems("ID").Text
the following may work
For Each item As ListViewItem In ListView1.SelectedItems()
TextBox1.AppendText(item.Text & ":" & item.SubItems(1).Text & Environment.NewLine)
Next
精彩评论