0

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

enter image description here

I have a Multi-Line textbox and a Button Like this

enter image description here

I want to load the selected note on the textbox when the button is clicked. How can I do this ?

2
  • Do you want the load the contents of the ListView item into the textbox, or the contents of the textbox into the ListView item? Commented Apr 26, 2011 at 14:40
  • @Cody - Contents of ListView item into text-box Commented Apr 26, 2011 at 15:02

2 Answers 2

5

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

Sign up to request clarification or add additional context in comments.

Comments

0

the following may work

For Each item As ListViewItem In ListView1.SelectedItems() TextBox1.AppendText(item.Text & ":" & item.SubItems(1).Text & Environment.NewLine) Next 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.