New window in a tabbed document window

2 posts, 0 answers
  1. Oguzhan
    Oguzhan avatar
    6 posts
    Member since:
    Dec 2010

    Posted 02 Nov 2014 Link to this post

    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?
     
  2. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 03 Nov 2014 Link to this post

    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.

     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top