HI, I have a generic function as shown below. It can be used to show a form by calling
showForm(ch);
IT works for the second function (new without parameter) ,But if I want to show form but with parameter in the constructor as in the third function (new with parameter) ,then I could not do it .Any one has an idea how to do it?
void showForm<T>(T frm) where T :Form, new()
{
if (frm == null)
{
frm = new T();
}
frm.MdiParent = this;
frm.Show();
}
//Works for this
public frmChild2()
{
InitializeComponent();
ChildToolStrip = toolStrip1;
// toolStrip1.Visible = false;
}
//Does not Work for this
public frmChild2(string title)
{
InitializeComponent();
ChildToolStrip = toolStrip1;
Text = title;
// toolStrip1.Visible = false;
}