Detect, in code behind, that i'm in the designer

Hi, i'd like to know if there is a way to detect if i'm running the report from the designer.
For example, using a preprocessor directives:
#if DESIGNER
// Initialize some variables to default value
// Show some message boxes
#endif

or maybe there is a static variable.
Is there a way?
Thank you very much.

Comments

  • edited 5:51AM
    It was very simple, just some reflection:
    if (System.Reflection.Assembly.GetEntryAssembly().GetName().Name == "Designer")
    {
       MessageBox.Show("Inside the designer");
    }
    
    capedica wrote: »
    Hi, i'd like to know if there is a way to detect if i'm running the report from the designer.
    For example, using a preprocessor directives:
    #if DESIGNER
    // Initialize some variables to default value
    // Show some message boxes
    #endif

    or maybe there is a static variable.
    Is there a way?
    Thank you very much.

Leave a Comment