Is There a way to add hidden values to a listview item?
I am creating a listview where I show data from a database. I also want to be able to edit this therefore I need two IDs to make sure it's the correct item and I don't mess up the database
Is there any way to do this? I Tried adding an ID to the TAG property of the list view item.
ListViewItem track = new ListViewItem();
track.Tag = id;
track.Text = ("Test: " + SL[i] + " Test: " + SL[i + 1]);
listView1.Items.Add(track);
But I need to add 2 IDs to an item.
EDIT: I am using Winforms
Here are two ways to solve this:
You can extend ListViewItem in a new class and add your two properties to that class.
You can create a Tuple that contains both IDs and store that in the Tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With