Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DesignMode
Message
From
28/08/2010 09:30:10
 
 
To
28/08/2010 05:08:12
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
01479015
Message ID:
01479029
Views:
42
>Hi,
>In VS many things what make me crazy.. one of them "DesignMode".
>I am one year with VS, time to be professional :))) but.. there exist things which I can't understand
>
>I have a container class.. in the Load event I wrote some code which communicate with my BusinessObjects and getting data
>Ok, then I write the code
>IF Not Me.DesginMode
> ......
>
>So I expect, when I working in Visual Studio and design class - this code will never executed. Its correct, sometimes.. and sometimes not
>
>Next situation I made a subclass of Container 1
>Modify Designer - DesignMode works super - all fine - no problem
>
>Next I put this container to the Form on the page of TabFrame.. and now - Class can't be open without error.. lots error and all depends from DataAccess.. but the dataAccess comes only from Load.. and in the Load writen
>IF Not Me.DesignMode
>
>Put the messagebox to Load of parent container - Modify designer - Bingo.. messagebox appears - Container fill in Runtime..
>
>Ok. So I google it.. found 1 million pages where 1 million programmers asks - how to check REAL DESIGN MODE .. and found 0 answers. One of most interesting was about ISite interface.... and then.. it seems one of the PARENT container where my container located does not support ISite interface, then DesignMode can't be inherited from top container and my control thinking ("I am in Runtime")
>
>Thats bad.. because it happens often. For example with diffrent BAR's (like toolbar, statusbar and so on) - they Ignore this ISite.
>
>
>Final question.
>When the Me.DesignMode - works just partial.. maybe its possible to write some function "IsRuntime" ?
>How to recognize - is currently designed class in VisualStudio - or running by my own Exe?
>So.
> The question is
>When someone has an Idea how to replace Me.DesignMode in controls in VisualStudio with something more usefull - please let me know,

Have you already tested using Assembly.GetEntryAssembly from the example here:
http://www.undermyhat.org/blog/2009/07/in-depth-a-definitive-guide-to-net-user-controls-usage-mode-designmode-or-usermode/
(also read comments at bottom of article)

Keep in mind the other causes for the EntryAssemby being null:
http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getentryassembly.aspx
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform