Work around for KB839202 "DesigmMode property .... is always false"
- From: viliam_batka@xxxxxxxxxxx
- Date: 12 Dec 2006 05:36:44 -0800
Hi,
The following text is describing an alternative to the DesignMode
property as work around for KB839202.
I have Win Form application that is using an app.config. Into
app.config I have placed extra Key "MyDesignMode" into appSettings
section.
<appSettings>
<add key="MyDesignMode" value="1" />
</appSettings>
Using code that is testing the existence of key in the App.config I
was able to determine whether I am in design or runtime mode:
object o =
System.Configuration.ConfigurationSettings.AppSettings["MyDesignMode"];
if (o == null)
{
// We are in design mode;
}
In design mode the key "MyDesignMode" from app.config is not
accessible and therefore the return value is 'null'.
This simple test I have placed in all my nested user control on all
required places (e.g. form constructor and Form_Load procedures), and
it has allowed me to work reasonable well without getting various
exceptions during my design.
Regards
Viliam Batka
.
- Prev by Date: User Control creating a control dynamically while in designer
- Next by Date: Designer not showing localized exception messages
- Previous by thread: User Control creating a control dynamically while in designer
- Next by thread: Designer not showing localized exception messages
- Index(es):
Relevant Pages
|