473,397 Members | 2,028 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,397 software developers and data experts.

How do I stop the designer from assigning properties to my usercontrols?

Jim
I have some complex (fairly) user controls that I have created. Some
of those user controls host other user controls. When I host one of
these on a WinForm, I sometimes run into problems where the designer
blows up with an "Object Reference Not Set to an Instance of an
Object". Sometimes it even (so kindly) "munches" my code in the
hosting control. Unfortunately, it seldm if ever tlss "where" exactly
the problem occurred, and to my knowledge there is no way to run the
designer in debug mode and stop through what it's doing.

My fix, for now, as been to put a "if( !DesignMode) test around al of
the set / get fxns in my properties. This works (usally.... Although
under certain circumstants, the designer has apparently not set the
value of the DesignMode property by the time these properties are
getting configured.) All this fact-checking in my propertis is
superfluous, were it not for the fact that the designer always wants
to assign values to them that sometimes do not make sense. Especially
and most particularly when the properties take objects as their
values, and the designer is trying to assign "NULL" to them.

Is there some attribute that I can assign to my properties that will
prevent the designer from trying to retreive values from, or assign
values to them while rendering the control in design mode? I have
seen the [Borwseable()] attribute, but that doesn't seem to fully
cover it. Is there a collection of information on these attributes
somewhere that I can read up on? Surely there has to be a better way
to do this other than what I am currently having to do.

Thanks for any help. :)

JIM

PS - Someone in the newsgroups said that the "IS" in fact a way to run
the designer in debug mode so that I can hunt dorwn problems like this
when they occur. Does anyone know how to do this or where the article
is on it? I still really think though that there is a way to keep the
thing from trying to set my properties for me. Any help is
appreciated.

Nov 17 '05 #1
1 1872
I found the article. Here is the link.

http://msdn.microsoft.com/library/de...edebugging.asp

Nov 17 '05 #2

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

Similar topics

2
by: Jim | last post by:
I have some complex (fairly) user controls that I have created. Some of those user controls host other user controls. When I host one of these on a WinForm, I sometimes run into problems where...
2
by: Vivek Sharma | last post by:
Hi There, I have a situation where I wish to load the controls dynamically on the basis of user role. Hence, I am using this code. if (UserRole == "IS Administrator") { Control UC1 =...
6
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
Yesterday Visual Studio gave me a strange error both at compiletime and at designtime that had no obvious connection to anything I had changed recently. After some effort tracking down the problem...
2
by: steve | last post by:
I have the very simple derived class below but when I drag the class from the toolbox on to one of my UserControls VS designer extracts the information and puts it into its resource database for the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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...

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.