开发者

How to get the selected row items in ListView

This is my ListView, Column 1 for ID and Column 2 for Notes

How to get the selected row items in ListView

I have a Multi-Line textbox and a Butt开发者_开发百科on Like this

How to get the selected row items in ListView

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜