Listview item key

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
 
C

Carlos J. Quintero [VB MVP]

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
 
A

Adam Honek

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
 
C

Carlos J. Quintero [VB MVP]

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
 

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