> Just post a short but complete code sample that illustrates the problem.
Willy.
below is one of functions in main form which display child form.
when child form is closed, it remains in memory
public static void showCForm(int arg)
{
try
{
CForm childForm=null;
foreach(Form f in Brazda.Startup.ActiveForm.MdiChildren)
{
if(f is CForm)
{
switch (arg)
{
case 122:
if (f.Text=="122") //brzi najam
childForm = (CForm) f;
break;
case 123:
if (f.Text=="123") //izmjena najma
childForm = (CForm) f;
break;
case 207:
if (f.Text=="207") //PC Blagajna (robno)
childForm = (CForm) f;
break;
case 422:
if (f.Text=="422") //brzi najam marina brod+gosti
childForm = (CForm) f;
break;
case 423:
if (f.Text=="423") //izmjena najma marina brod+gosti
childForm = (CForm) f;
break;
case 722:
if (f.Text=="722") //brzi najam
childForm = (CForm) f;
break;
case 723:
if (f.Text=="723") //izmjena najma
childForm = (CForm) f;
break;
case 807:
if (f.Text=="807") //POS
childForm = (CForm) f;
break;
}
}
}
if( childForm != null)
{ //it is already open, just show it
childForm.Show();
childForm.Focus();
}
else
{ //load form
childForm = new CForm(arg);
childForm.MdiParent = Brazda.Startup.ActiveForm;
childForm.Show();
childForm.Focus();
}
}
catch//(Exception exp)
{
//MessageBox.Show(exp.Message);
}
}