Is there a design-time flag?

P

popman

If a public property is Browsable,it will appear in vs.net 's designer's
property window.and the code in that property will be run either.But I don't
want the code to be run at design-time.Is there a design-time flag,so the
code can be skip at design-time? like

if not #design-time then
..........
..........
end if

Thanks.
 
B

Brian W

Unfortunatly, there doesn't seem to be one.

One way I have seen it done, and what seems to work for me, is to check if
Context is null (Nothing in VB.NET)

if (Context != null )
// Do this

If (Not Context Is Nothing) Then
' Do that
End If


Brian W
 
M

mikeb

popman said:
If a public property is Browsable,it will appear in vs.net 's designer's
property window.and the code in that property will be run either.But I don't
want the code to be run at design-time.Is there a design-time flag,so the
code can be skip at design-time? like

if not #design-time then
.........
.........
end if

// in C#...
if ((this.Site != null) && (this.Site.DesignMode)) {
// we're in design mode
}

See:

http://msdn.microsoft.com/msdnmag/issues/03/12/CuttingEdge/default.aspx

for more details.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top