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
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
Thanks in advance
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.
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.
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 tab) with 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
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?
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.
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):
- I've created a RadRibbonForm and placed a radDock control on it
- In the RadDock I've added a Tool Window and a Document Window
- In the DocumentWindow I've placed a RadCarousel and added several items to it
- 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)
- 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
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
Additionally, could Excel and/or a spreadsheet be embedded this way?
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
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 >>