This is a migrated thread and some comments may be shown as answers.

Multiple Instances of the Same Form

1 Answer 113 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Samantha
Top achievements
Rank 1
Samantha asked on 13 Feb 2015, 02:47 PM
I have a dock with multiple Document Windows.  

I want to open multiple instances of the same form on different document windows.  Each form. although the same, needs to contain different data.

Every time I open a second instance of the form on a second document window, the first instance of the form on the first document window disappears.  The second instance contains the data from the first instance, when it should be maintaining the data from the second document window.

Is there any way to get around this?  

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 17 Feb 2015, 05:00 PM
Hi Samantha,

Thank you for writing.

I am not sure why you are getting such behavior, however you should be able to add the forms properly with the following code:
int count = 0;
private void radButton1_Click(object sender, EventArgs e)
{
    DocumentWindow newDockWindow = new DocumentWindow();
    newDockWindow.Text = count.ToString();
    newDockWindow.CloseAction = DockWindowCloseAction.Hide;
    RadForm form = new RadForm();
    form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
    form.TopLevel = false;
    form.Dock = DockStyle.Fill;
 
    RadTextBox box = new RadTextBox();
    box.Text = "Text Box " + count++;
    box.Location = new Point(100, 100);
    form.Controls.Add(box);
 
    newDockWindow.Controls.Add(form);
    this.radDock1.AddDocument(newDockWindow);
    form.Show();
 
    radDock1.ActiveWindow = newDockWindow;
}

I hope this helps. Should you have any other questions do not hesitate to ask.
 
Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Dock
Asked by
Samantha
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or