locked
UserControl Design Mode when Lib ois Imported RRS feed

  • Question

  •     public partial class StartUPEmbedded : UserControl, IMessageFilter
        {
            public StartUPEmbedded()
            {
                InitializeComponent();
                if (this.DesignMode) return;
                this.ParentForm.FormClosing += new FormClosingEventHandler(StartUP_FormClosing);
                con = new Conversation("itbrigada");
                con.Hide();
                Broadcaster.Connected += Broadcaster_Connected;
                client = new CommunicatorClient();
                client.Responder = new Broadcaster.DResponder(Responder);
                client.Start();
                Application.AddMessageFilter(this);
                MailBox.MailBoxUpdate += MailBox_MailBoxUpdate;
            }

    just th epart of the UserCitrl that has done in different solution.. same .NET.. imported Ok.. but..

    when drag and drop it on the form I get the error message: says nullreference at line and it corresponds to the next after

    if(this.DesignMode) return;

    What's wrong? Any other condition? Tried to place all that below lines inside OnLoad - then was able to drop, but it was frozen and even the DevEnv reloaded the whole solution.. ??? ))

    this.DesignMode doesn't work in that case?
    • Edited by RobbKirk Thursday, August 1, 2019 8:03 AM
    Thursday, August 1, 2019 7:54 AM

Answers

  • bool designMode = (LicenseManager.UsageMode == LicenseUsageMode.Designtime);
    if (designMode) return;


    this helped..
    • Marked as answer by RobbKirk Thursday, August 1, 2019 8:07 AM
    • Edited by RobbKirk Thursday, August 1, 2019 8:09 AM
    Thursday, August 1, 2019 8:07 AM