Only one instance allow in winforms c# | SoloLearn: Learn to code for FREE!

0

Only one instance allow in winforms c#

Hello Members, In my windows forms application that have menu strip. I need to make program that only allow one instance. Means from menu if user open Student and need to open another windows systems not allow him. Please help.

11/28/2017 12:48:35 PM

Salman Mushtaq

3 Answers

New Answer

0

You need a program that allow only one instance of what exactly? only one instance of application? or a form?

0

Dear, Let me explain my scenario, I have a form form1 and form2. In form1 there is Menustrip and option to open Form2. Once Form2 is open, user not allowed to do anything on form1 without closing form2.

0

I get the solution, I need to use ShowDialog() instead of Show(); Like SybForm f = new SubForm(); f.ShowDialog(this); Where this is instance of main form.