I have this exact implementation right here: http://nbug.codeplex.com/SourceControl/changeset/view/6081#107027 , which implements the IPanelLoader interface (ISubmitPanel for my case) and loads any panel using the same name in combo box. Basically download the source code and compile it and look at the Configurator project. There are many things that will require me to explain pages, but there is already a complete example.
In my case, any form that implements the ISubmitPanel interface (MailForm, FtpForm, etc. in my case) can be loaded as follows:
private void SubmitComboBox_SelectedIndexChanged(object sender, EventArgs e) { switch (this.submitComboBox.SelectedItem.ToString()) { case "E-Mail": this.Controls.Add(new MailForm()); break; case "FTP": this.Controls.Add(new FtpForm()); break; case "HTTP": this.Controls.Add(new HttpForm()); break; } }
Of course, this code should work in a different form, where you want to load another form.


Edit: Source code is NBug project.
source share