On Application startup
public form1()
{
    InitializeComponent();
    dirPath1 = ConfigurationManager.AppSettings["path1"];
    dirPathath2 = ConfigurationManager.AppSettings["path2"];
    if ((!Directory.Exists(dirPath1)) && (!Directory.Exists(dirPath2)))
    {
        this.Close();              
        Application.Run(new form2());
    }
    //rest of code
}
On Form2 cancel button click
private void btnCancel_Click(object sender, EventArgs e)
{
    Application.Exit();            
}
According to me, application should be stopped now. But what it does, is continue executing the "rest of code" part in form1 constructor.