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

Launching forms in tabbed document gives an error

1 Answer 38 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 10 Jun 2009, 09:41 AM
Hi

Using Rad dock as a mdi container and trying to launch forms in document but getting error below - does this mean forms can not be added to the tabed document view?

ERROR;
Top-level control cannot be added to a control.

Code for Enquiry which is rad form

 

Enquiry enquiry = new Enquiry();

 

 

DocumentWindow document = new DocumentWindow();

 

document.Text =

"New Enquiry form";

 

document.Controls.Add(enquiry);

enquiry.Dock =

DockStyle.Fill;

 

 

this.radDock1.AddDocument(document);

Rgds
Stephen

 

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 11 Jun 2009, 09:23 AM
Hello Stephen,

You can use the new API for hosting form or control in RadDock in this scenario:

Form form = new Form(); 
RadGridView gridView = new RadGridView(); 
gridView.Dock = DockStyle.Fill; 
form.Controls.Add(gridView); 
form.Visible = true
        
HostWindow hostWindow = new HostWindow(form); 
radDock1.AddDocument(hostWindow); 

Do not hesitate to write me back if you have further questions.

Greetings,
Julian Benkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Dock
Asked by
Stephen
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question
or