Hi Masters,
I am creating a windows Form application . It will have left hand navigation bar on click of each item I have to load the form. So I have created a Shell application(.exe) and placed splitter controladded my Left hand Navigation bar on thePanel1 . I also created Library of my forms as UserControls deriving from my Base User Controls. When ever the user clicks on the left hand navigation bar , based on the Id , I am loading the required control(Form) in the Panel2 and removing the control and disposing it using reflection . Just I want to find ,Is it the right way of doing .
Please guide me I am doing ok or not
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
string formId = e.Node.Tag.ToString();
if (formId != "")
{
BaseControl bc = new BaseControl("");
Assembly asm = Assembly.LoadFrom("PwC.TT.PAS.UI.dll");
Type t = asm.GetType("PwC.TT.PAS.UI." + formId);
Object obj = Activator.CreateInstance(t);
bc = (
BaseControl)obj;
foreach (Control ct in splitContainer1.Panel2.Controls)
{
splitContainer1.Panel2.Controls.Remove(ct);
ct.Dispose();
}
splitContainer1.Panel2.Controls.Add(bc);
}
}
Thank so much
Regards,
YNKR