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

loading one instance of a form to tabbed document list

2 Answers 56 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Ren
Top achievements
Rank 1
Ren asked on 13 Jan 2008, 06:38 PM
How can I load one instance of a form to the tabbed document list? I am current running this code.
 
    Private Sub newMDIRadButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles newMDIRadButton.Click
        Form5.MdiParent = Me
        Form5.Show()
    End Sub
 
 
but if I close the document from the tab and try to load it again, it doesn't work. Also, if I click the button one more time while the form5 loaded, it disappears.

2 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 14 Jan 2008, 01:48 PM
Hello Ren,

When Form5 is loaded for the first time, the DocumentPane wrapper is created (Parent for Form5) and registered with the DockingManager. When Form5 is closed from the DockingManager, then only the parent (DocumentPane) is unregistered from the DockingManager. In this situation you may use the following code snippet:

if (form.Parent == null)  
{  
    form.MdiParent = this;  
    form.Show();  
}  
else 
{  
    dockingManager1.SetDocument((DocumentPane)form.Parent);  
 

If you need any further assistance, please contact us.

All the best,
Julian Benkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Michael
Top achievements
Rank 1
answered on 17 Jan 2008, 10:49 PM
FYI, I was running into this situation earlier today when I came across the following article,

http://www.deltasblog.co.uk/code-snippets-2/code-snippets/

I then changed the following code

foreach (Form frm in this.MdiChildren) 

to this

foreach (Form f in dockingManager1.MdiChildren) 

and everything works well.

I hope this helps.

Michael
Tags
Dock
Asked by
Ren
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Michael
Top achievements
Rank 1
Share this question
or