Adding an object to listview-item?

B

Boris Nienke

hi,

i would like to store an object along with an listview-item. Something
like:

ListViewItem item = new ListViewItem();
item.Text = "Text"
item.SubItems.Add("Text2")

item.Object = MyObject;

listview1.Items.Add(item);

Is this possible? And how to get the selected item/object when the user
clicks the item?

thank you

Boris
 
A

Alex Yakhnin [MVP]

Create your own ListViewItem by deriving from it and add
Object or Tag property.

HTH... Alex
 

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

Top