```csharp
static void Main()
{
bool createdNew;
using(Mutex mutex=new Mutex(true,Application.ProductName,out createdNew))
{
if (createdNew)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
else
{
MessageBox.Show("Only One Instance is allowed");
System.Environment.Exit(1);
}
}
}