Home All Groups Group Topic Archive Search About
Author
19 Apr 2006 1:49 AM
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

Author
19 Apr 2006 8:52 AM
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


Show quoteHide quote
"Adam Honek" <AdamHo***@Webmaster2001.freeserve.co.uk> escribió en el
mensaje news:uguWRO1YGHA.1016@TK2MSFTNGP03.phx.gbl...
> 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
>
Author
19 Apr 2006 11:52 PM
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

Show quoteHide quote
"Carlos J. Quintero [VB MVP]" <carlosq@NOSPAMsogecable.com> wrote in message
news:OChRh64YGHA.4920@TK2MSFTNGP02.phx.gbl...
> 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
>
>
> "Adam Honek" <AdamHo***@Webmaster2001.freeserve.co.uk> escribió en el
> mensaje news:uguWRO1YGHA.1016@TK2MSFTNGP03.phx.gbl...
>> 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
>>
>
>
Author
20 Apr 2006 9:30 AM
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



Show quoteHide quote
"Adam Honek" <AdamHo***@Webmaster2001.freeserve.co.uk> escribió en el
mensaje news:O6DYJxAZGHA.1200@TK2MSFTNGP03.phx.gbl...
> 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