Run multiple winform instance sequentially

Maybe this can work:

public static bool IsProgramRunning(string TitleOfYourForm)
    bool result = false;
    Process[] processes = Process.GetProcesses();
    foreach (Process p in processes)
         if (p.MainWindowTitle.Contains(TitleOfYourForm))
             result = true;
    return result;

Call this function in the Main function(before opening the mainForm), if it is false Application.Exit() else show your form..
If this answer helped you, vote me.

Browse More Popular Posts

Leave a Comment