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

Open a windows form in tabbed document

10 Answers 816 Views
Dock
This is a migrated thread and some comments may be shown as answers.
John Thompson
Top achievements
Rank 1
John Thompson asked on 01 Dec 2010, 06:06 PM
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) 
  
  

 

 

 

 

 

 


10 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 06 Dec 2010, 11:16 AM
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.
0
John Thompson
Top achievements
Rank 1
answered on 06 Dec 2010, 02:42 PM
Perfect, exactly what I needed to know.  Works great.  Thanks a lot!
0
Damián
Top achievements
Rank 1
answered on 13 Oct 2011, 02:28 PM
Could i do this inside a RadDock tab?
Thanks in advance
0
Nikolay
Telerik team
answered on 18 Oct 2011, 01:44 PM
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.

0
Damián
Top achievements
Rank 1
answered on 18 Oct 2011, 02:19 PM
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





0
Nikolay
Telerik team
answered on 20 Oct 2011, 11:31 AM
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.

0
Peter Stanford
Top achievements
Rank 1
answered on 25 Apr 2012, 05:40 AM
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

0
Nikolay
Telerik team
answered on 30 Apr 2012, 08:41 AM
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 >>
0
Brendan
Top achievements
Rank 1
answered on 21 Oct 2013, 08:08 PM
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?
0
Nikolay
Telerik team
answered on 22 Oct 2013, 11:33 AM
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 >>
Tags
Dock
Asked by
John Thompson
Top achievements
Rank 1
Answers by
Stefan
Telerik team
John Thompson
Top achievements
Rank 1
Damián
Top achievements
Rank 1
Nikolay
Telerik team
Peter Stanford
Top achievements
Rank 1
Brendan
Top achievements
Rank 1
Share this question
or