Nested WinForms open in RadDocument Host Window

2 posts, 0 answers
  1. Satyajeet B
    Satyajeet B avatar
    11 posts
    Member since:
    Aug 2009

    Posted 25 Sep 2009 Link to this post

    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).


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


    objForm.Dock = DockStyle.None

    hostWindow.AutoScroll =



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



    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.


  2. Nikolay
    Nikolay avatar
    1805 posts

    Posted 01 Oct 2009 Link to this post

    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.

    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.
Back to Top