Updated: 19/02/2005; 8:25:43.
Hannes 'Shorty' Decorte's Radio Weblog
Learning .Net and the Experiences doing so


zondag 2 januari 2005

Sometimes checking the DesignMode property is not sufficient. For example checking DesignMode in a UserControl contained in a UserControl returns false. Which is, if you think about it, correct. What you really want to know is whether or not your control is running inside VS.Net IDE.

Here is the code.

protected bool InDesignMode()
{
   if (this.DesignMode)
   {return true;}
   
   if (System.Reflection.Assembly.GetEntryAssembly() == null)
   {
    return true;
   }
   
   return false;
}


11:37:52 AM    comment []

© Copyright 2005 Hannes 'Shorty' Decorte.
 

January 2005
Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Dec   Feb


RSS Feed

Other .Net Bloggers

Bart De Smet
Jan Tielens
Patrick Verbruggen
Patrick Tisseghem
Tom van de Kerkhof's Bloggings
Tom's Corner
Yves Hanoulle

Aggregated Feeds

Belgian .NET Bloggers