Only the sample program can be run (using the Process) C#

Only the sample program can be run (using the Process)
Import using System.Diagnostics namespace

using System.Diagnostics;

These changes in the class apply to the StartUp program:

static class Program
{
    [STAThread]
    static void Main()
    {
        if (IsPrevInstance())
            return;
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }

    private static bool IsPrevInstance()
    {
        string processName = Process.GetCurrentProcess().ProcessName;
        Process[] instances = Process.GetProcessesByName(processName);
        if (instances.Length > 1)
            return true;
        else
            return false;
    }
}