Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Dock > Open a windows form in tabbed document

Not answered Open a windows form in tabbed document

Feed from this thread
  • John Thompson avatar

    Posted on Dec 1, 2010 (permalink)

    Is it possible to open a windows form in an already existing tab?  I have predefined tabs in a DocumentTabStip and I want to open a windows form inside of the tab when the tab is selected.

    Doing the following will fill the existing tab and create a new blank tab, but I just want to fill the existing tab.  I'm sure I'm missing something simple here, but have been struggling for some time.  If I eliminate the second line, I get an error.

     
    Dim myForm As New Form1()
    Me.DocumentWindow1.DockManager.DockControl(myForm, DocumentWindow1, DockPosition.Fill) 
      
    DocumentWindow1.Controls.Add(myForm) 
      
      

     

     

     

     

     

     


    Reply

  • Stefan Stefan admin's avatar

    Posted on Dec 6, 2010 (permalink)

    Hello John,

    Thank you for writing.

    Please refer to the following code snippet which demonstrates how can you add a form to an existing DocumentWindow:
    Dim myForm As New Form()
    myForm.BackColor = Color.Red
    myForm.Dock = DockStyle.Fill
    myForm.TopLevel = False
    'the next line removes the form's title bar
    myForm.FormBorderStyle = Windows.Forms.FormBorderStyle.None
    myForm.Show()
    Me.DocumentWindow1.Controls.Add(myForm)

    I hope this information helps. If there is anything else I can assist you with, do not hesitate to contact me.

    All the best,
    Stefan
    the Telerik team
    Get started with RadControls for WinForms with numerous videos and detailed documentation.

    Reply

  • John Thompson avatar

    Posted on Dec 6, 2010 (permalink)

    Perfect, exactly what I needed to know.  Works great.  Thanks a lot!

    Reply

  • Damián avatar

    Posted on Oct 13, 2011 (permalink)

    Could i do this inside a RadDock tab?
    Thanks in advance

    Reply

  • Nikolay Nikolay admin's avatar

    Posted on Oct 18, 2011 (permalink)

    Hi Damián,

    Could you please clarify your requirement? The code snippet of my colleague Stefans does just this - it inserts a Form object into an existing DocumentWindow in RadDock. If this is not what you are looking for, please describe your case in details. This will allow us to think of a solution that will be helpful for your case.

    Thank you for your cooperation.

    All the best,
    Nikolay
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

    Reply

  • Damián avatar

    Posted on Oct 18, 2011 (permalink)

    Thanks Nikolai for attending my problem. We are from Uruguay and we are looking for a pool of controls that can easily integrate the new version of our main product. I've using your components(trial version) and i faced with the next issue:

    I have a main form with a raddock that opens tabs to show diffrent parts of the application or sub applications (something like a web explorer).
    I wonder if I can open, in these tabs, modal forms that only disables the tab that contain them.

    Sorry about my english.

    pd. I solved the previous problem (open a form inside a tabwith the following code:

    Dim host As HostWindow = RadDock1.DockControl(frm, Telerik.WinControls.UI.Docking.DockPosition.Right)
            host.DockState = Telerik.WinControls.UI.Docking.DockState.Floating

    Thank you again, regards
    Damián Hernandez


    Genesys
    Departamento de Desarrollo
    Bvar. Batlle y Ordóñez 2405 esq. Ayuí CP 11600
    Montevideo - Uruguay
    (+598) 2481 4365   (+598) 2487 2071





    Reply

  • Nikolay Nikolay admin's avatar

    Posted on Oct 20, 2011 (permalink)

    Hello Damián,

    I am glad that you manage to find the solution to your previous question.

    However, I am not sure I understand your new requirement as well. Let's say that you add a form to a DockWindow in RadDock. How the tab of the window that contains the form should be disabled?

    All the best,
    Nikolay
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

    Reply

  • Peter Stanford avatar

    Posted on Apr 25, 2012 (permalink)

    Hi Stefan,

    I've just come across this post while searching for a similar solution. I appreciate that the post is old and may be out of date but I'm using the latest version of WinForms Controls (Q1 2012, Vers: 321?), Visual Studio 2010 and VB.net. I'm trying to do the following (all the controls are Telerik Rad controls, not native Windows controls):

     

    1.  I've created a RadRibbonForm and placed a radDock control on it
    2. In the RadDock I've added a Tool Window and a Document Window
    3. In the DocumentWindow I've placed a RadCarousel and added several items to it
    4. At runtime when I click one of the items in the carousel (rbeCustomers), I want to create a new document window (this part works correctly)
    5. In the new document window I want to place a new instance of a form

    What I can't find is how to asign this form to the document window because the new document window (DocumentWindow99 in this example) doesn't appear in the list of controls if I use the syntax Me.DocumentWindow99.Controls.Add(Customer_Management).

    I could create the documet windows at design time but I really want to create them dynamically at run time. Any assistance would be greatle appreciated.

    Thanks and best regards

    Here's the code I'm using:

     

     

     

     

    Private Sub rbeCustomers_Click(sender As System.Object, e As System.EventArgs) Handles rbeCustomers.Click
        With RadDock1
            Dim DocumentWindow99 As DocumentWindow = New DocumentWindow
            DocumentWindow99.Text = "Customers"
            .AddDocument(DocumentWindow99)
        End With
        Dim Customer_Management As New Customer_Management
        With Customer_Management
            .Dock = DockStyle.Fill
            .TopLevel = False
            .FormBorderStyle = Windows.Forms.FormBorderStyle.None
            .Show()
        End With
    End Sub

    Reply

  • Nikolay Nikolay admin's avatar

    Posted on Apr 30, 2012 (permalink)

    Hello Peter,

    Thank you for writing.

    You should set a meaningful Name property to the DocumentWindow when creating it. You can then get the window from the DockWindows collection, for example:

    Private Sub RadButton1_Click(sender As System.Object, e As System.EventArgs) Handles RadButton1.Click
        With RadDock1
            Dim DocumentWindow99 As DocumentWindow = New DocumentWindow
            DocumentWindow99.Text = "Customers"
            DocumentWindow99.Name = "Customers"
            .AddDocument(DocumentWindow99)
        End With
        Dim f As New Form
        With f
            .BackColor = Color.Green
            .Dock = DockStyle.Fill
            .TopLevel = False
            .FormBorderStyle = Windows.Forms.FormBorderStyle.None
            .Show()
        End With
     
        Me.RadDock1.DockWindows("Customers").Controls.Add(f)
    End Sub

    I hope this helps.Kind regards,
    Nikolay
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Dock > Open a windows form in tabbed document
Related resources for "Open a windows form in tabbed document"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]