Open a windows form in tabbed document

11 posts, 0 answers
  1. John Thompson
    John Thompson avatar
    5 posts
    Member since:
    Oct 2009

    Posted 01 Dec 2010 Link to this post

    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) 
      
      

     

     

     

     

     

     


  2. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 06 Dec 2010 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. John Thompson
    John Thompson avatar
    5 posts
    Member since:
    Oct 2009

    Posted 06 Dec 2010 Link to this post

    Perfect, exactly what I needed to know.  Works great.  Thanks a lot!
  5. Damián
    Damián avatar
    2 posts
    Member since:
    Sep 2011

    Posted 13 Oct 2011 Link to this post

    Could i do this inside a RadDock tab?
    Thanks in advance
  6. Nikolay
    Admin
    Nikolay avatar
    1804 posts

    Posted 18 Oct 2011 Link to this post

    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.

  7. Damián
    Damián avatar
    2 posts
    Member since:
    Sep 2011

    Posted 18 Oct 2011 Link to this post

    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





  8. Nikolay
    Admin
    Nikolay avatar
    1804 posts

    Posted 20 Oct 2011 Link to this post

    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.

  9. Peter Stanford
    Peter Stanford avatar
    7 posts
    Member since:
    Mar 2010

    Posted 25 Apr 2012 Link to this post

    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

  10. Nikolay
    Admin
    Nikolay avatar
    1804 posts

    Posted 30 Apr 2012 Link to this post

    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 >>
  11. Brendan
    Brendan avatar
    52 posts
    Member since:
    Dec 2011

    Posted 21 Oct 2013 Link to this post

    Taking this a step further, is it possible to open/embed an external program in a document window?  For example, I would like to show external_program.exe in a document window rather than have it open in its own window.

    Additionally, could Excel and/or a spreadsheet be embedded this way?
  12. Nikolay
    Admin
    Nikolay avatar
    1804 posts

    Posted 22 Oct 2013 Link to this post

    Hi Brendan,

    The RadDock component itself does not provide any specific means for embedding external applications in a DockWindow, and this question actually concerns a more general topic - the ability to host an external application in your application. There is a decent StackOverflow discussion about the same. You can read more about the topic here.

    Regards,
    Nikolay
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready