How to open only one instance of a form
  • hello
    I want to know how can i restrict my application to open one instance of a form. 
    waiting for some help/suggestions
    sajid
  • 3 Comments sorted by
  • Make form as static
  • how to make a form static. Please share some code example
  •  public static Form IsFormAlreadyOpen(Type FormType)
            {
                foreach (Form OpenForm in System.Windows.Forms.Application.OpenForms)
                {
                    if (OpenForm.GetType() == FormType)
                        return OpenForm;
                }
                return null;
            }          

     var status = IsFormAlreadyOpen(SampleForm));

                if (status == null)
              {


    }
    else
    {


    }








Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Tagged

Popular Posts of the Week

    Optimum Creative