Listview and no ValueMember

John C

New member
Joined
Apr 27, 2007
Messages
3
Location
Manchester UK
Programming Experience
10+
What do think is the best way to hold a value against a row in a ListView, because there does not seem to be a ValueMember property?

I have just added a column with the value in, but it seems to me that there will be a much better way.

Any help appreciated.
 
hmmm, create an array at the same time or an arraylist? then when writing to the ListView put the value in an array?

eg

VB.NET:
Expand Collapse Copy
listview.add "text"
ArrayList.add "an items value"

and if you do this correct the indexes will match for easy reference.
 
What do think is the best way to hold a value against a row in a ListView
Put it in the Tag property of each ListViewItem.
 
What do think is the best way to hold a value against a row in a ListView, because there does not seem to be a ValueMember property?

I have just added a column with the value in, but it seems to me that there will be a much better way.

Any help appreciated.

Why use a listview? Alternately, put the whole row into the listview, and override ToString for the row so that it shows whatever display member you want. Naturally, it is easier if the row is a typed one..
 
Back
Top