You must create a singleton class to manage form instances:
public class FormProvider { public static UserForm UserForm { get { if (_userForm== null || _userForm.IsDisposed) { _userForm= new UserForm (); } return _userForm; } } private static UserForm _userForm; }
NB, this is a very simple Singleton template. To use the template correctly, use the link .
Then you can simply access the form as follows:
FormProvider.UserForm.Show(); FormProvider.UserForm.MdiParent = this;
When FormProvider.UserForm opened for the first time, it will be created. Any subsequent hit in the FormProvider.UserForm property returns a form created upon first access. This means that the form will be created only once.
source share