Description
code of auto application close in win form application in visual studio 2010

Explanation & Answer

using System;
using System.Windows.Forms;
using System.Drawing;
class TestClass
{
static void Main(string[] args)
{
System.Windows.Forms.Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new myForm());
}
}
using System;
using System.Collections.Generic;
...
public partial class myForm : Form
{
int x = 0;
}
...
I want to close myForm automatically when x = 0 and do not close when x = 1;
