473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Custom Control property problem

When I put any component on a form, all of the initial values of the
components properties are collected in a auto created private method named
InitializeComponent. like this:
----------------------------------------------
this.button1.Location = new System.Drawing.Point(66, 279);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
-------------------------------------------------------------------
When I put my own control, all of its properties are added into the
InitializeComponent methode except the GraphInfo class which I defined it as
a property using the below code:
-------------------------------
[Category("Graph")]
[Browsable(true)]
public List<GraphInfoGraphs
{
get { return this.graphs; }
}
#endregion
-------------------------------
The class consists of a number of integer values.
Any idea?

Thanks in advance,
Mehrdad

Jun 27 '08 #1
7 1032
On Fri, 06 Jun 2008 11:39:06 -0700, Mehrdad <ga****@irandoc.ac.irwrote:
[...]
When I put my own control, all of its properties are added into the
InitializeComponent methode except the GraphInfo class which I defined
it as
a property using the below code:
-------------------------------
[Category("Graph")]
[Browsable(true)]
public List<GraphInfoGraphs
{
get { return this.graphs; }
}
#endregion
-------------------------------
The class consists of a number of integer values.
Any idea?
Are you sure that the Designer supports that?

I admit, I use the Designer in only the most rudimentary ways most of the
time, so I'm not familiar with the exact details for stuff like this. But
it's not surprising to me at all that the Designer might ignore a property
that's a List<of some arbitrary class you've defined, at least by
default.

It's _possible_ there's some way to write some sort of plug-in component
for the Designer that would handle this. But otherwise, I'm not sure what
you expect the Designer to do with that. What sort of UI would it present
to the user for initialization of this arbitrary collection?

Pete
Jun 27 '08 #2
Thank you for your response. Accually, as a part of a project, I need to
build a specific histogram (control) which can support multiple graphs. The
GraphInfo class contains all of the information for the each indivisual
graph and I need to define it as a dynamic array property to support
unlimited number of graphs.

Thank you again,
Mehrdad

"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Fri, 06 Jun 2008 11:39:06 -0700, Mehrdad <ga****@irandoc.ac.irwrote:
>[...]
When I put my own control, all of its properties are added into the
InitializeComponent methode except the GraphInfo class which I defined
it as
a property using the below code:
-------------------------------
[Category("Graph")]
[Browsable(true)]
public List<GraphInfoGraphs
{
get { return this.graphs; }
}
#endregion
-------------------------------
The class consists of a number of integer values.
Any idea?

Are you sure that the Designer supports that?

I admit, I use the Designer in only the most rudimentary ways most of the
time, so I'm not familiar with the exact details for stuff like this. But
it's not surprising to me at all that the Designer might ignore a property
that's a List<of some arbitrary class you've defined, at least by
default.

It's _possible_ there's some way to write some sort of plug-in component
for the Designer that would handle this. But otherwise, I'm not sure what
you expect the Designer to do with that. What sort of UI would it present
to the user for initialization of this arbitrary collection?

Pete

Jun 27 '08 #3
On Jun 6, 2:39 pm, "Mehrdad" <gal...@irandoc.ac.irwrote:
When I put any component on a form, all of the initial values of the
components properties are collected in a auto created private method named
InitializeComponent. like this:
----------------------------------------------
this.button1.Location = new System.Drawing.Point(66, 279);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
-------------------------------------------------------------------
When I put my own control, all of its properties are added into the
InitializeComponent methode except the GraphInfo class which I defined it as
a property using the below code:
-------------------------------
[Category("Graph")]
[Browsable(true)]
public List<GraphInfoGraphs
{
get { return this.graphs; }}

#endregion
-------------------------------
The class consists of a number of integer values.
Any idea?

Thanks in advance,
Mehrdad
Just taking shot here.. try adding a set property and see what
happens..
Jun 27 '08 #4
On Fri, 06 Jun 2008 12:13:37 -0700, Mehrdad <ga****@irandoc.ac.irwrote:
Thank you for your response. Accually, as a part of a project, I need to
build a specific histogram (control) which can support multiple graphs.
The
GraphInfo class contains all of the information for the each indivisual
graph and I need to define it as a dynamic array property to support
unlimited number of graphs.
Well, as has been suggested to you twice already, the Designer may not
show you the property unless it has a setter that can be used to set the
value.

However, in the end...just because you _need_ to do something, that
doesn't mean that the Designer will support that particular something. I
appreciate your essay regarding how you want to use this property, but I
don't see how that's relevant with respect to whether the Designer will
work with that use.

I recommend you follow the advice that has been given to you and add a
setter for the property. If that doesn't do the trick, then it's entirely
possible you can't do this, given the lack of suggestions other than that.

Pete
Jun 27 '08 #5
No difference!!!

Thanks,
Mehrdad
"parez" <ps*****@gmail.comwrote in message
news:77**********************************@x41g2000 hsb.googlegroups.com...
On Jun 6, 2:39 pm, "Mehrdad" <gal...@irandoc.ac.irwrote:
>When I put any component on a form, all of the initial values of the
components properties are collected in a auto created private method
named
InitializeComponent. like this:
----------------------------------------------
this.button1.Location = new System.Drawing.Point(66, 279);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
-------------------------------------------------------------------
When I put my own control, all of its properties are added into the
InitializeComponent methode except the GraphInfo class which I defined it
as
a property using the below code:
-------------------------------
[Category("Graph")]
[Browsable(true)]
public List<GraphInfoGraphs
{
get { return this.graphs; }}

#endregion
-------------------------------
The class consists of a number of integer values.
Any idea?

Thanks in advance,
Mehrdad

Just taking shot here.. try adding a set property and see what
happens..

Jun 27 '08 #6
Actually, the desiner shows the property in the "properties" window, but
after adding some graphs in the collection, non of the graphs info is saved
in the InitializeComponent methode, so, by closing and reopening the VS2008,
all of the graphs info are removed from the collection!!!

Thanks,
Mehrdad

"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Fri, 06 Jun 2008 12:13:37 -0700, Mehrdad <ga****@irandoc.ac.irwrote:
>Thank you for your response. Accually, as a part of a project, I need to
build a specific histogram (control) which can support multiple graphs.
The
GraphInfo class contains all of the information for the each indivisual
graph and I need to define it as a dynamic array property to support
unlimited number of graphs.

Well, as has been suggested to you twice already, the Designer may not
show you the property unless it has a setter that can be used to set the
value.

However, in the end...just because you _need_ to do something, that
doesn't mean that the Designer will support that particular something. I
appreciate your essay regarding how you want to use this property, but I
don't see how that's relevant with respect to whether the Designer will
work with that use.

I recommend you follow the advice that has been given to you and add a
setter for the property. If that doesn't do the trick, then it's entirely
possible you can't do this, given the lack of suggestions other than that.

Pete

Jun 27 '08 #7
On Fri, 06 Jun 2008 14:07:30 -0700, Mehrdad <ga****@irandoc.ac.irwrote:
Actually, the desiner shows the property in the "properties" window, but
after adding some graphs in the collection, non of the graphs info is
saved
in the InitializeComponent methode, so, by closing and reopening the
VS2008,
all of the graphs info are removed from the collection!!!
Sorry to say, I'm not really sure what else you expected. The Designer
can easily deal with properties of primitive types. But I would expect
for complex types, it would have no way of knowing implicitly how to
construct instances of the classes you're dealing with.

I have seen hints that the Designer is actually quite flexible, and that
if you want some specific functionality, it's possible to _write_ special
handlers for particular data types you want. But the scenario you're
talking about is something I'd be surprised to see handled automatically.

I could be wrong. After all, you _are_ posting in the C# newsgroup.
There's random knowledge here about various .NET and VS topics, but it is
a language-specific newsgroup after all. I recommend that, given no
specific descriptions of how to do this have been posted so far, you may
want to find a newsgroup that is more specific to the use of Visual
Studio, or even the Designer specifically.

Pete
Jun 27 '08 #8

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

Similar topics

7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.