473,466 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to set default properties for subclassed controls

If I subclass TextBox and add my own new properties, how do I set their
default values? I tried assigning them in the default constructor, but they
still show as bold in the object inspector and they still get assigned in
the code-behind file, neither of which would be the case if they had
"default" values.

TIA,

Mike Rodriguez
Nov 17 '05 #1
2 1262
Try taking a look at the DefaultValueAttribute.
http://msdn.microsoft.com/library/de...ClassTopic.asp
"Michael Rodriguez" <mi**@nospamforme.com> wrote in message
news:eI****************@TK2MSFTNGP15.phx.gbl...
If I subclass TextBox and add my own new properties, how do I set their
default values? I tried assigning them in the default constructor, but
they still show as bold in the object inspector and they still get
assigned in the code-behind file, neither of which would be the case if
they had "default" values.

TIA,

Mike Rodriguez

Nov 17 '05 #2
That's just what I needed!

Thanks, James.

Mike
"James Swindell" <ja******@hotmail.com> wrote in message
news:OY**************@TK2MSFTNGP15.phx.gbl...
Try taking a look at the DefaultValueAttribute.
http://msdn.microsoft.com/library/de...ClassTopic.asp
"Michael Rodriguez" <mi**@nospamforme.com> wrote in message
news:eI****************@TK2MSFTNGP15.phx.gbl...
If I subclass TextBox and add my own new properties, how do I set their
default values? I tried assigning them in the default constructor, but
they still show as bold in the object inspector and they still get
assigned in the code-behind file, neither of which would be the case if
they had "default" values.

TIA,

Mike Rodriguez


Nov 17 '05 #3

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

Similar topics

8
by: deko | last post by:
I'm hoping someone can sanity check my understanding of the Object Model for Forms/Controls. I'm having trouble drilling down into Control properties. First, I have a record set with the...
3
by: countd4 | last post by:
I have built a working user control. However, to make it work, I always have to set certian properties using the properties sheet for the control when using it on other forms. I want to be able to...
1
by: Greg | last post by:
I have a custom control called PageBanner which is compiled into a DLL and then put into the toolbox. It shows like I would expect it to in the toolbox, and I can drag and drop it onto a form. ...
1
by: Vinod I | last post by:
Hi Team, I made a custom validator control which is having 2 public properties. But after making dll & adding that to the ToolBox, I could not able to find these properties in Property Box. ...
4
by: XNoDE | last post by:
Hi all, VS.Net 2002. Is there a way to set default properties for controls in the Toolbox? There a some properties that I implement as standard in my apps and would like to get around...
3
by: Marty McFly | last post by:
Hello, I have a control class that inherits from System.Web.UI.WebControls.Button. When I drag this control from the "My User Controls" tab in the toolbox onto the form, I want it to reflect the...
4
by: Dennis | last post by:
I am trying to set the default design proerties in a control I have derived from the Panel Class. I thought I'd found how to do it from the MSDN but the following line doesn't work: Inherits...
12
by: Ray Cassick \(Home\) | last post by:
Ok, I have finally decided that there is ONE big thing about VB.NET (not sure if this same thing exists in C# yet) that really ticks me off. Either I am missing the point here or I have not found...
3
by: CJM | last post by:
I'm currently working on an assembly that has both forms and controls in it. When I create a new control based on UserControl and compile, it shows up in the toolbox for all forms in this...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.