Is there a design-time flag?

Discussion in 'ASP .Net' started by popman, May 23, 2004.

  1. popman

    popman Guest

    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.
    popman, May 23, 2004
    #1
    1. Advertising

  2. popman

    Brian W Guest

    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

    "popman" <> wrote in message
    news:...
    > 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.
    >
    >
    Brian W, May 23, 2004
    #2
    1. Advertising

  3. popman

    mikeb Guest

    popman wrote:
    > 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.

    --
    mikeb
    mikeb, May 24, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Cook
    Replies:
    0
    Views:
    442
    Paul Cook
    Nov 6, 2003
  2. Tzury Bar Yochay
    Replies:
    3
    Views:
    479
    Jacob Yang [MSFT]
    Nov 29, 2003
  3. Bura Tino
    Replies:
    7
    Views:
    760
    Dale King
    Apr 15, 2006
  4. flamesrock
    Replies:
    8
    Views:
    438
    Hendrik van Rooyen
    Nov 24, 2006
  5. mrhicks
    Replies:
    3
    Views:
    335
    James Dow Allen
    Sep 1, 2004
Loading...

Share This Page