Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Dock > When LoadContent Form_Load Event isn't called

Not answered When LoadContent Form_Load Event isn't called

Feed from this thread
  • Sari avatar

    Posted on Oct 4, 2011 (permalink)

    I use LoadContent method to load content of my form, but  Form_Load Event isn't called. Any help?

    HostWindow hw;
    ...
    Form f = GetFormHostWindow(hw.Name);
    if (f != null) hw.LoadContent(f);

    Reply

  • Posted on Oct 6, 2011 (permalink)

    Hello Sari,

    Yes, you have a couple of options.
    First, move everything from Load to the forms constructor.
    Second, after creating the form Form f = ...
    register for f.Show += .... event an then in that event call hw.LoadContent(f)

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga

    Telerik WinForms MVP

    Reply

  • Sari avatar

    Posted on Oct 7, 2011 (permalink)

    Thank you.

    Reply

  • Jack Jack admin's avatar

    Posted on Oct 7, 2011 (permalink)

    Hello Sari,

    Thank you for contacting us. 

    The purpose of the LoadContent method is just to load a control in a HostWindow and if this control is a form - to strip its titlebar. If your form has already been loaded once, the LoadContent will not cause the form to fire its Load event again. Here is a usage of the LoadContent where the Load event of the form is fired as expected, because the form is loaded for the first time in the application:
    private void radButton1_Click(object sender, EventArgs e)
    {
        HostWindow h = this.radDock1.DockControl(new RadButton(), DockPosition.Left);
     
        Form f = new Form();
        f.Load += new EventHandler(f_Load);
        h.LoadContent(f);
    }
     
    void f_Load(object sender, EventArgs e)
    {
        throw new NotImplementedException();
    }

    If you have additional questions, feel free to write back.
     
    Best wishes,
    Jack
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Dock > When LoadContent Form_Load Event isn't called
Related resources for "When LoadContent Form_Load Event isn't called"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]