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

Nested WinForms open in RadDocument Host Window

1 Answer 120 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Satyajeet B
Top achievements
Rank 1
Satyajeet B asked on 25 Sep 2009, 11:48 AM
Hi there,

I am using Rad dock in my application to open existing winforms using below code. On click of RadMenuButtonItem an existing WinForm opens in a NewDocument(HostWindow).

objForm=

New Form
Dim hostWindow As HostWindow = RadDock1.DockControl(objForm, DockPosition.Right)

 

objForm.Dock = DockStyle.None

hostWindow.AutoScroll =

True

 

RadDock1.AddDocument((hostWindow), DockPosition.Fill)

hostWindow.ScrollControlIntoView(hostWindow)

objForm.Show()

This works fine. 
Now the form opened in the host window has a button, on click of that button again an existing form should open in a new RadDocument Host Window. In the button click event i am creating an object of that form and just calling Obj.Show() which opens the form normally. Can anyone please assist how can i open the second form in Host Window aswell.

Thanks

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 01 Oct 2009, 01:10 PM
Hi Satyajeet B,

Here is a sample implementation of the form that contains the button:
Public Class Form2  
    Dim hostParent As HostWindow  
 
    Private Sub Form2_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load  
        hostParent = Me.Parent  
    End Sub 
 
    Private Sub RadButton1_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles RadButton1.Click  
        If hostParent IsNot Nothing Then 
            Dim f3 As Form3 = New Form3  
            hostParent.DockManager.DockControl(f3, DockPosition.Left, DockType.Document)  
        End If 
    End Sub 
End Class 

As you can see, I am simply getting the parent of the form which is the HostWindow that hosts the form. I can get the RadDock control by the DockManager property of the HostWindow. Next, I just need to create an instance of the second form and dock it with the help of the DockControl method.

I hope this helps. If you have additional questions, feel free to contact me.

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Dock
Asked by
Satyajeet B
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or