473,503 Members | 2,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hide property at designtime

Hi,
If I make a control, I want to be able to make it so that various
properties are not initialised by the designer.

I realise that if you put [Browsable(false)] that it won't show up in
the properties window... but for some reason the auto-generated code
insists on initialising it anyway. This is really irritating. Does
anyone know how to stop this?

Cheers
Greg

Nov 17 '05 #1
3 14169
gr**********@gmail.com wrote:
Hi,
If I make a control, I want to be able to make it so that various
properties are not initialised by the designer.

I realise that if you put [Browsable(false)] that it won't show up in
the properties window... but for some reason the auto-generated code
insists on initialising it anyway. This is really irritating. Does
anyone know how to stop this?


It's my understanding that every property (public) is initialized, you
can't do a thing about it. The only thing you can do is to do all the
'serialization' at design time for your control, but you don't want that
I think, as you then have to generate ALL code for your control.

Why do you want to have some properties not to be initialized? If it's
the code vs.net generates which deserializes objects from a resource
file, you can fix that by defining a type converter class for that type
which checks if the destination type is an InstanceDescriptor, and if so
you should create one in your own typeconverter.

Frans

--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Nov 17 '05 #2
Does anyone know how to stop this?


Check out the DesignerSerialization attribute.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 17 '05 #3
Thanks,
[DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)]
seemed to do it :)

Greg

Nov 17 '05 #4

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

Similar topics

1
2063
by: Roger | last post by:
Hi, i want to make an ambient property for my control. i have the ambient part working just fine , but in order to make this work correctly in designtime i need to be able to set the...
4
2020
by: DraguVaso | last post by:
Hi, I'm having some weird behaviour, and I can't find any solution to this. I made a UserControl (uclCommands) which contains a Toolbar (ToolBar1) with Modifiers = Public. I put this...
3
23017
by: ASGMikeG | last post by:
Hi, I'm upgrading an application from VB6 to .NET. It used tab controls in VB6 to achieve a tab dialogue / wizard type effect - navigating from one tab to the next as the user filled in...
0
1256
by: stew_mclean | last post by:
Hi, I've developed a class that derives from component (rather than a control), and am trying to license it at design time. I've set the license attributes etc. to my custom license provider: ...
4
2973
by: Weinand Daniel | last post by:
i'd like to monitor changes of the "Control.Name" porperty during designtime. if the user changes the name in designer my event musst fire. i have created a own button control. with an event...
13
1783
by: Peter Kirk | last post by:
Hi there, can someone tell me what exactly a "property" is in a C# class? As far as I can see it is "two methods" - ie a getter and a setter for an instance variable. What is the difference...
3
2807
by: Lance | last post by:
I have a situation where I want to show a property when one object is selected in a PropertyGrid, but I want to hide that property when more than one object is selected. For example, lets say I have...
7
4425
by: Andrea Moro | last post by:
I'm writing my first windows control library. A simple textbox with some numeric facilities. Well, there is a strange thing that happen. I want to add a locked property. As many other property,...
0
782
by: Nenefta | last post by:
Hi all, I would like to create something that should be fairly simple I guess, but I just might be taking a wrong road here or just don't know where to look for an answer. Please enlighten me! ...
0
7093
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
7287
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
7349
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...
0
7467
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...
1
5022
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
3177
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
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.