Check if open is already open
-
do it with the form load event that like this: if (Process.GetProcessesByName(yourprocessname).Length >=1){ MessageBox.show("already opened!"); return; }
I think he meant some form he has in his application, not the application itself
-
I think he meant some form he has in his application, not the application itself
-
do it with the form load event that like this: if (Process.GetProcessesByName(yourprocessname).Length >=1){ MessageBox.show("already opened!"); return; }
-
I think he meant some form he has in his application, not the application itself
-
do it with the form load event that like this: if (Process.GetProcessesByName(yourprocessname).Length >=1){ MessageBox.show("already opened!"); return; }
Use singleton design pattern and it'll solve your problem for example u want form1 to be checked if it's already opened take a object of form1 with in your form1 class make the constructor private of your form1 class make a public static method with in that method check if the object is null or not if null assign a new instance of your form1 and if not null then return the already initialized instance
-
Best way to solve this is to to make your class constructor private and put static method that returns reference to only instance of your class Code example:
class Example { private static Example THIS = null; public static Example CREATE_FORM() { if (THIS == null) THIS = new Example(); return THIS; } private Example() { } }