0

Is there a way to Open/Show the form if it already exists? I have used Mutex to check if an instance of my app is open.

This is the code for my program.cs file.


 static void Main() {
            bool InstanceCount = false;

            using (Mutex m = new Mutex(true, "MyRunningApp", out InstanceCount)) {
                if (InstanceCount) {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new Main());
                    m.ReleaseMutex();
                }

                else {
                    MessageBox.Show("Power Monitor is Already RUNNING, Please Check the System Tray.");
                }
            }
        }

I tried Show(); but it give me this error "The name 'show' does not exist in the current context".

paraJdox1
  • 805
  • 9
  • 23

0 Answers0