473,320 Members | 1,979 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,320 software developers and data experts.

Custom Control

I've created a GUI control for my form. It has a public property
that's a generic list. When I use the control on a form, Visual
studio automatically generates the code in InitializeComponents. The
generic list property always gets set null here. How do prevent this
code property from being generated in InitializeComponents?

Dec 18 '07 #1
3 1515
Hi,
How do you want to initialize it?
And to what value?

You could init it in your own class to a new instance and make the property
read only

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Rick" <ad***@thebinarysolution.comwrote in message
news:72**********************************@q3g2000h sg.googlegroups.com...
I've created a GUI control for my form. It has a public property
that's a generic list. When I use the control on a form, Visual
studio automatically generates the code in InitializeComponents. The
generic list property always gets set null here. How do prevent this
code property from being generated in InitializeComponents?

Dec 18 '07 #2
Rick,

Well, it doesn't make much sense that you would expose a setter for the
property that exposes the List. You can expose the List<Tas read only,
(just a getter) and the designer won't try and set the value.

From a design standpoint, it doesn't make sense to allow code outside of
your control replace the entire collection (meaning, the List<Titself).
Rather, it should just modify elements in that collection.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rick" <ad***@thebinarysolution.comwrote in message
news:72**********************************@q3g2000h sg.googlegroups.com...
I've created a GUI control for my form. It has a public property
that's a generic list. When I use the control on a form, Visual
studio automatically generates the code in InitializeComponents. The
generic list property always gets set null here. How do prevent this
code property from being generated in InitializeComponents?
Dec 18 '07 #3
In this case, it's a list of items that I'll be displaying. But the
question applies to any datatype. In some cases, the property might
be a business object of some sort.

On Dec 18, 9:16 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Rick,

Well, it doesn't make much sense that you would expose a setter for the
property that exposes the List. You can expose the List<Tas read only,
(just a getter) and the designer won't try and set the value.

From a design standpoint, it doesn't make sense to allow code outside of
your control replace the entire collection (meaning, the List<Titself).
Rather, it should just modify elements in that collection.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"Rick" <ad...@thebinarysolution.comwrote in message

news:72**********************************@q3g2000h sg.googlegroups.com...
I've created a GUI control for my form. It has a public property
that's a generic list. When I use the control on a form, Visual
studio automatically generates the code in InitializeComponents. The
generic list property always gets set null here. How do prevent this
code property from being generated in InitializeComponents?
Dec 18 '07 #4

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

Similar topics

6
by: Christian H | last post by:
Hi! I've created a custom control (myDrawControl) that deals with drawing. This control is then added to a form( myMainForm) Now, whenever something is dragged and dropped onto myDrawControl ,...
15
by: Tinus | last post by:
Hello all, I've created a custom control that draws a monthly schedule (using the Draw function in C#). Basically it draws 31 boxes and writes the day number in every box. This works...
21
by: One Handed Man \( OHM - Terry Burns \) | last post by:
When using a custom control. In order to check and see if values have changed one has to implement the IPostBackDataCollection interface. The values returned for the control seem to be simply a...
1
by: Wannabe_Geek | last post by:
Hi Iam new to MS .Net technology just getting along with it....I created a custom control ,which takes in a query and displays the data in a tabular format....something similar to a datagrid. ...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
4
by: Smokey Grindle | last post by:
What is the best way to write dynamic controls in ASP.NET 2.0?
11
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with...
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...
5
by: gerry | last post by:
I am trying to create a custom container control that will only ever contain a specific type of control. At design time, when a control of a different type is added to the container I would like...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
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.