Prevent Duplicate Windows

5 posts, 0 answers
  1. Ramachandran
    Ramachandran avatar
    8 posts
    Member since:
    Jul 2017

    Posted 21 Jul Link to this post

     

     

        I have three forms .In the form Button Exit Click form is closed but the  Data is not initializing in the Text Box and Gridview.

  2. Hristo
    Admin
    Hristo avatar
    1018 posts

    Posted 21 Jul Link to this post

    Hi Ramachandran,

    Thank you for writing.

    I am not sure what the nature of your issue is and how it can be reproduced. Can you please provide us more details about your actual scenario? A code snippet and a short video showing the behavior on your end would also help.

    Looking forward to your reply.

    Regards,
    Hristo
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Ramachandran
    Ramachandran avatar
    8 posts
    Member since:
    Jul 2017

    Posted 22 Jul in reply to Hristo Link to this post

    Hi Hristo

    Thanks for your reply.

    Herewith i am attaching a video for your understanding.

    I am using RadDock and Rad Forms. I am calling the form in RadDock using this code. 

    1. I want to prevent the same form should not be loaded. and working not full.
    2. When i close and double click on the treeview the form is opened with the same values
    when i hav closed. all the data and grid details remains in the control.

    I tried this.close, this.parent.close all methods still the problem persist. 

    Please help in how to prevent the same form should not be called and varibles should
    initialise.

    I tried the below code. Expecting your reply at the earliest.

    Thanks and Regards


       frmCustomerEnquiry frmCustEnquiry = new frmCustomerEnquiry(strTheme, dtUserRights);
       DisplayForm(frmCustEnquiry);

       private void DisplayForm(System.Windows.Forms.Form form)
            {

                bool blnFormExists;
                blnFormExists = false;

                this.Cursor = Cursors.WaitCursor;

                foreach (Form form1 in DockEnquiry.MdiChildren)
                {
                    if (form1.GetType() == form.GetType())
                    {
                        DockEnquiry.ActivateMdiChild(form1);
                        blnFormExists = true;
                        break;

                    }
                }
                if (blnFormExists == true)
                {
                }
                else
                {
                    form.MdiParent = this;
                   // DockEnquiry.close
                    form.Show();

                    Telerik.WinControls.UI.Docking.HostWindow host = (Telerik.WinControls.UI.Docking.HostWindow)form.Parent;
                    DockEnquiry.ActivateWindow(host);
                }

                form.Focus();
                this.Cursor = Cursors.Default;
            }
  4. Ramachandran
    Ramachandran avatar
    8 posts
    Member since:
    Jul 2017

    Posted 22 Jul in reply to Hristo Link to this post

    Hi Hristo

    Thanks for your reply.

    Herewith i am attaching a video for your understanding.

    I am using RadDock and Rad Forms. I am calling the form in RadDock using this code. 

    1. I want to prevent the same form should not be loaded. and working not full.
    2. When i close and double click on the treeview the form is opened with the same values
    when i hav closed. all the data and grid details remains in the control.

    I tried this.close, this.parent.close all methods still the problem persist. 

    Please help in how to prevent the same form should not be called and varibles should
    initialise.

    I tried the below code. Expecting your reply at the earliest.

    Thanks and Regards


       frmCustomerEnquiry frmCustEnquiry = new frmCustomerEnquiry(strTheme, dtUserRights);
       DisplayForm(frmCustEnquiry);

       private void DisplayForm(System.Windows.Forms.Form form)
            {

                bool blnFormExists;
                blnFormExists = false;

                this.Cursor = Cursors.WaitCursor;

                foreach (Form form1 in DockEnquiry.MdiChildren)
                {
                    if (form1.GetType() == form.GetType())
                    {
                        DockEnquiry.ActivateMdiChild(form1);
                        blnFormExists = true;
                        break;

                    }
                }
                if (blnFormExists == true)
                {
                }
                else
                {
                    form.MdiParent = this;
                   // DockEnquiry.close
                    form.Show();

                    Telerik.WinControls.UI.Docking.HostWindow host = (Telerik.WinControls.UI.Docking.HostWindow)form.Parent;
                    DockEnquiry.ActivateWindow(host);
                }

                form.Focus();
                this.Cursor = Cursors.Default;
            }
  5. Dimitar
    Admin
    Dimitar avatar
    1871 posts

    Posted 24 Jul Link to this post

    Hello Ramachandran,

    I have tested this on my side and it works as expected (I have attached my test project).

    In addition, the following article shows how this can be achieved as well: Docking Singleton Forms.

    I hope this is useful.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top