Home All Groups Group Topic Archive Search About

Add object to listview

Author
24 Jul 2006 10:03 AM
XiScO
Hi!
sometime ago, a friend show me that in BC++ you could add an objet to each
element of a listview. Now I wnat to know if it is possible to do this on
VB.net 2005.
I've a collection of objects and show some of their properties on the
listview, if I could attach the object to each file of the listview it'll
be easier.
Thnaks.
bye

Author
24 Jul 2006 10:28 AM
Cor Ligthert [MVP]
XiSco,

A ListView has items (no elements), that are special objects which can hold
a lot of information.
AFAIK can a listview not hold direct whatever object.

http://msdn2.microsoft.com/en-us/library/system.windows.forms.listviewitem_members.aspx

You can add to listviewitems again (detail) items (to show in detailview).

I hope this helps,

Cor



Show quoteHide quote
"XiScO" <sincor***@aqui.es> schreef in bericht
news:uZq4egwrGHA.984@TK2MSFTNGP05.phx.gbl...
> Hi!
> sometime ago, a friend show me that in BC++ you could add an objet to each
> element of a listview. Now I wnat to know if it is possible to do this on
> VB.net 2005.
> I've a collection of objects and show some of their properties on the
> listview, if I could attach the object to each file of the listview it'll
> be easier.
> Thnaks.
> bye
Author
24 Jul 2006 10:45 AM
XiScO
Thanks for the reply. I don't understand exactly what you say (english is
not my native language).
I want a listitem which conaints some string and an object (not shown).
Particulary I add computers to the listview, so i show computer name, ip
and mac. I create an object with this data, wich has public methods to make
ping, wakeonlan, etc.
So I want the object as a member of the the listview so when a click is done
in one listview element I call the objet.method.
Is clear what I want to do?
Thanks again.
Cor Ligthert [MVP] wrote:

> XiSco,
>
> A ListView has items (no elements), that are special objects which can
> hold a lot of information.
> AFAIK can a listview not hold direct whatever object.
>
>
http://msdn2.microsoft.com/en-us/library/system.windows.forms.listviewitem_members.aspx
Show quoteHide quote
>
> You can add to listviewitems again (detail) items (to show in detailview).
>
> I hope this helps,
>
> Cor
>
>
>
> "XiScO" <sincor***@aqui.es> schreef in bericht
> news:uZq4egwrGHA.984@TK2MSFTNGP05.phx.gbl...
>> Hi!
>> sometime ago, a friend show me that in BC++ you could add an objet to
>> each element of a listview. Now I wnat to know if it is possible to do
>> this on VB.net 2005.
>> I've a collection of objects and show some of their properties on the
>> listview, if I could attach the object to each file of the listview it'll
>> be easier.
>> Thnaks.
>> bye
Author
24 Jul 2006 11:24 AM
Cor Ligthert [MVP]
Xisco,

Simple than, no that is impossible,

Cor

Show quoteHide quote
"XiScO" <sincor***@aqui.es> schreef in bericht
news:ebu393wrGHA.940@TK2MSFTNGP02.phx.gbl...
> Thanks for the reply. I don't understand exactly what you say (english is
> not my native language).
> I want a listitem which conaints some string and an object (not shown).
> Particulary I add computers to the listview, so i show computer name, ip
> and mac. I create an object with this data, wich has public methods to
> make
> ping, wakeonlan, etc.
> So I want the object as a member of the the listview so when a click is
> done
> in one listview element I call the objet.method.
> Is clear what I want to do?
> Thanks again.
> Cor Ligthert [MVP] wrote:
>
>> XiSco,
>>
>> A ListView has items (no elements), that are special objects which can
>> hold a lot of information.
>> AFAIK can a listview not hold direct whatever object.
>>
>>
> http://msdn2.microsoft.com/en-us/library/system.windows.forms.listviewitem_members.aspx
>>
>> You can add to listviewitems again (detail) items (to show in
>> detailview).
>>
>> I hope this helps,
>>
>> Cor
>>
>>
>>
>> "XiScO" <sincor***@aqui.es> schreef in bericht
>> news:uZq4egwrGHA.984@TK2MSFTNGP05.phx.gbl...
>>> Hi!
>>> sometime ago, a friend show me that in BC++ you could add an objet to
>>> each element of a listview. Now I wnat to know if it is possible to do
>>> this on VB.net 2005.
>>> I've a collection of objects and show some of their properties on the
>>> listview, if I could attach the object to each file of the listview
>>> it'll
>>> be easier.
>>> Thnaks.
>>> bye
>
Author
26 Jul 2006 12:20 PM
XiScO
Ok, thanks
Cor Ligthert [MVP] wrote:

Show quoteHide quote
> Xisco,
>
> Simple than, no that is impossible,
>
> Cor
>
> "XiScO" <sincor***@aqui.es> schreef in bericht
> news:ebu393wrGHA.940@TK2MSFTNGP02.phx.gbl...
>> Thanks for the reply. I don't understand exactly what you say (english is
>> not my native language).
>> I want a listitem which conaints some string and an object (not shown).
>> Particulary I add computers to the listview, so i show computer name, ip
>> and mac. I create an object with this data, wich has public methods to
>> make
>> ping, wakeonlan, etc.
>> So I want the object as a member of the the listview so when a click is
>> done
>> in one listview element I call the objet.method.
>> Is clear what I want to do?
>> Thanks again.
>> Cor Ligthert [MVP] wrote:
>>
>>> XiSco,
>>>
>>> A ListView has items (no elements), that are special objects which can
>>> hold a lot of information.
>>> AFAIK can a listview not hold direct whatever object.
>>>
>>>
>>
http://msdn2.microsoft.com/en-us/library/system.windows.forms.listviewitem_members.aspx
Show quoteHide quote
>>>
>>> You can add to listviewitems again (detail) items (to show in
>>> detailview).
>>>
>>> I hope this helps,
>>>
>>> Cor
>>>
>>>
>>>
>>> "XiScO" <sincor***@aqui.es> schreef in bericht
>>> news:uZq4egwrGHA.984@TK2MSFTNGP05.phx.gbl...
>>>> Hi!
>>>> sometime ago, a friend show me that in BC++ you could add an objet to
>>>> each element of a listview. Now I wnat to know if it is possible to do
>>>> this on VB.net 2005.
>>>> I've a collection of objects and show some of their properties on the
>>>> listview, if I could attach the object to each file of the listview
>>>> it'll
>>>> be easier.
>>>> Thnaks.
>>>> bye
>>
Author
24 Jul 2006 2:45 PM
Claes Bergefall
You can use the ListViewItem.Tag property to store private data that should
be associated with a particular item

   /claes

Show quoteHide quote
"XiScO" <sincor***@aqui.es> wrote in message
news:uZq4egwrGHA.984@TK2MSFTNGP05.phx.gbl...
> Hi!
> sometime ago, a friend show me that in BC++ you could add an objet to each
> element of a listview. Now I wnat to know if it is possible to do this on
> VB.net 2005.
> I've a collection of objects and show some of their properties on the
> listview, if I could attach the object to each file of the listview it'll
> be easier.
> Thnaks.
> bye