By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,234 Members | 2,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,234 IT Pros & Developers. It's quick & easy.

Exception firing at design time - how to avoid?

P: n/a
1) I have created a visual control that relies on a logic class to do much
of its work.
2) The logic class will be assigned on the form through a register method.
3) I have a public property for accessing the control defined.
4) To avoid other people calling the control before it is initialized I
throw an ArgumentNullException in the propert.get section.

My problem is that when I place this visual control on a form, the exception
is firing. How do I get this exception to only fire at runtime or do I need
to re-arrange my code/thinking?

public LogicObj Logic
{
get
{
if ( _logic == null ) throw new ArgumentNullException(...);
return _logic;
}
}

thx

jack
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Jack Addington" <ja********@shaw.ca> wrote in message
news:eg**************@TK2MSFTNGP12.phx.gbl...
1) I have created a visual control that relies on a logic class to do much
of its work.
2) The logic class will be assigned on the form through a register method.
3) I have a public property for accessing the control defined.
4) To avoid other people calling the control before it is initialized I
throw an ArgumentNullException in the propert.get section.

My problem is that when I place this visual control on a form, the
exception is firing. How do I get this exception to only fire at runtime
or do I need to re-arrange my code/thinking?


Look at the DesignMode property. It's true when you're in a designer.

if (!DesignMode)...


Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.