Launching forms in tabbed document gives an error

2 posts, 0 answers
  1. Stephen
    Stephen avatar
    15 posts
    Member since:
    May 2007

    Posted 10 Jun 2009 Link to this post

    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

     

  2. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 11 Jun 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top