Listview item key

  • Thread starter Thread starter Adam Honek
  • Start date Start date
A

Adam Honek

Assuming lv.items.add(key,text, image index)

In a listview with items and subitems in each row, how do we
get the key value of the selected row?

The examples I see check for selectedindices it seems. In
VB6 I used a API method but surely in .Net there's such a
inbuilt method?

Thanks,
Adam
 
Hi Adam,

Try with the ListViewItem.Name property for the selected items.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
 
Under which LV event would this go?

Isn't it better to use the key rather than the name of the 1st column's
displayed text?

I need to link the LV to then allow some code that deletes an entry in an
INI file corresponding to the name of the LV item key.

Adam
 
Hi Adam,

ListViewItem.Name returns the key that you used in the call
ListView1.Items.Add(key, text,....)

There is some incoherence because sometimes it is called Key, and sometimes
name. Do not confuse it with the text.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
 
Back
Top