"If you do anything "out of the ordinary" in your UserControl or Form derived classes in Visual Studio 2005, let me introduce you to a little snippet that will probably save you lots of headaches:
if ( DesignMode ) return;
or, its equally useful counterpart
if(!DesignMode){
doStuff();
}
..."
I think I can use that...
There are times with some of the third party controls I use, that I need to make a code change that at runtime works fine, but causes a WSOD at design time. So I’m thinking the above snip, or something like it, might just be the ticket...
But it still feels horky. I might feel better refactoring the entire thing to eliminate the need to make the code change that causes the WSOD in the first place. But with a couple lines of code horky code vs hours of refactoring work, I’m might just deal with the horkyness...
Technorati Tags: Visual Studio 2005, WinForm, DesignMode
No comments:
Post a Comment
NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...
ALL comments are moderated. I will review every comment before it will appear on the blog.
Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...
I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...
Please see my comment policy for more information if you are interested.
Thanks,
Greg
PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...