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

New window in a tabbed document window

1 Answer 243 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Oguzhan
Top achievements
Rank 1
Oguzhan asked on 03 Nov 2014, 05:10 AM
Hi,

I've looked at the previous answers on this one such as http://www.telerik.com/forums/open-a-windows-form-in-tabbed-document however this doesn't do the trick for me. The goal is to design controls for a new document window and load that with details when the user double clicks on a list item to edit and view it in detail. When I try adding it as such:

            detailsForm _detailsForm = new detailsForm(listitem);
            _detailsForm.Dock = DockStyle.Fill;
            _detailsForm.TopMost = false;
            _detailsForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            _detailsForm.Show();
            this.documentWindow1.Controls.Add(_detailsForm);

I get the below exception:

System.ArgumentException was unhandled by user code
  HResult=-2147024809
  Message=Top-level control cannot be added to a control.
  Source=System.Windows.Forms
  StackTrace:
       at System.Windows.Forms.Control.ControlCollection.Add(Control value)
.....

Any ideas why?
 

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 03 Nov 2014, 04:07 PM
Hi Oguzhan,

Thank you for writing.

RadDock provides a method that allows you to directly dock the form and the document window will be automatically created for you: 
private void radButton1_Click(object sender, EventArgs e)
{
    RadForm1 form = new RadForm1();
    form.BackColor = Color.Pink;
    form.Text = "My Form";
 
    this.radDock1.DockControl(form, DockPosition.Left, DockType.Document);
    form.Show();
}

Detailed information can be found here: Getting Started.

Let me know if you have additional questions.
 
Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Dock
Asked by
Oguzhan
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or