Friday, March 31, 2006

VS8, WinForm and DesignMode

Blue Fenix - Visual Studio 2005 Designer: Touchy, Thouchy!

"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: , ,

No comments: