473,503 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ListViewItem property ListView

The ListViewItem class contains a readonly property called ListView which
returns the item's containing ListView object.

I have not been able to figure out how this value is set. The
ListViewItemCollection class Add method has to be able to set this value,
but ListViewItem does not expose any public or protected methods/properties
that support setting the value.

I have looked for Rotor source code for the classes, but haven't been able
to find any.

The reason I want this information is to use it as an example of how to
write my own classes that support the item knowing its container. This
information has to be readonly to external users. Setting the container
value for the item has to occur within the Add method of the container.

Thank you for your help

Chuck
Nov 16 '05 #1
2 6984

"Chuck" <ce*****@austin.rr.com> wrote in message
news:3x*****************@fe1.texas.rr.com...
The ListViewItem class contains a readonly property called ListView which
returns the item's containing ListView object.

I have not been able to figure out how this value is set. The
ListViewItemCollection class Add method has to be able to set this value,
but ListViewItem does not expose any public or protected methods/properties that support setting the value.
The ListViewItem class includes an internal method called Host, which is
called by the ListView when the item is inserted into the list view.
I have looked for Rotor source code for the classes, but haven't been able
to find any.
Rotor doesn't have any System.Windows.Forms types. Use Reflector.
The reason I want this information is to use it as an example of how to
write my own classes that support the item knowing its container. This
information has to be readonly to external users. Setting the container
value for the item has to occur within the Add method of the container.


class X
{
Box _box = null;
internal void SetBox(Box box)
{
_box = box;
}

public Box Box
{
get { return _box; }
}
}

class Box
{
public void Add(X x)
{
x.SetBox(this);
}
}
--
Mickey Williams
Author, "Visual C# .NET Core Ref", MS Press
www.neudesic.com
www.servergeek.com
Nov 16 '05 #2
Thanks for the help.
Reflector is very helpful. For anyone else interested you can find it at:
http://www.aisto.com/roeder/dotnet/ along with some other utilities I
haven't tried, but look interesting.

Chuck

"Mickey Williams [C# MVP]" <my first name at servergeek dot com> wrote in
message news:uf**************@TK2MSFTNGP12.phx.gbl...

"Chuck" <ce*****@austin.rr.com> wrote in message
news:3x*****************@fe1.texas.rr.com...
The ListViewItem class contains a readonly property called ListView which
returns the item's containing ListView object.

I have not been able to figure out how this value is set. The
ListViewItemCollection class Add method has to be able to set this value,
but ListViewItem does not expose any public or protected

methods/properties
that support setting the value.


The ListViewItem class includes an internal method called Host, which is
called by the ListView when the item is inserted into the list view.
I have looked for Rotor source code for the classes, but haven't been
able
to find any.


Rotor doesn't have any System.Windows.Forms types. Use Reflector.
The reason I want this information is to use it as an example of how to
write my own classes that support the item knowing its container. This
information has to be readonly to external users. Setting the container
value for the item has to occur within the Add method of the container.


class X
{
Box _box = null;
internal void SetBox(Box box)
{
_box = box;
}

public Box Box
{
get { return _box; }
}
}

class Box
{
public void Add(X x)
{
x.SetBox(this);
}
}
--
Mickey Williams
Author, "Visual C# .NET Core Ref", MS Press
www.neudesic.com
www.servergeek.com


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1843
by: LV | last post by:
Hello, I would like to manually set one of my list view items as selected. When this item is set, I would like for a method to execute. I have a delegate on the list view for SelectedIndexChanged....
6
13077
by: grs | last post by:
The following is a code example from the Microsoft MSDN. My question is on the following three lines of code: ListViewItem item1 = new ListViewItem("item1",0); ListViewItem item2 = new...
2
3682
by: Fritz | last post by:
I know it, I know it. It's come up a lot. I've done the Googling, but the standard answer doesn't do what I expect it to. For the record, the standard answer is: "Set the Selected property of a...
2
1436
by: naikrovek | last post by:
Hello all. I have a ListView on a form, that has columns added at design-time but will be populated run-time. So, I know what the columns will be, and I know that I will have an arbitrary...
1
4240
by: LagartijaNick | last post by:
Question: I have a ListView in which I'm selecting a ListViewItem based on the value of a textbox. On my XP machine (with default color scheme) the ..Selected row is a noticable grey (back color...
2
3924
by: Kela | last post by:
An interesting problem: I have a ListView with LabelEdit set to TRUE. When I change the label, I want to make some decisions as to whether the ListViewItem (that's just been edited) should stay in...
13
10198
by: deciacco | last post by:
How can I have access to the items collection of a listview control on my form from a background thread? I know I need delegates to update the listview control and I have those calls in the...
10
3500
by: Gav | last post by:
I am trying to have a ListView to dispay a list of names and want to have an id stored within the list but not visable. I have tried to go about doing this by using the ListViewItem and setting...
2
6115
by: witpo | last post by:
Hi, I would like to display all listview items in one row with scroll bar below it – instead of multiple rows and scroll bar on the right. Someone told me that I can achieve it using...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.