Using VS2005, windows forms, c#
I have 6 forms, some of them children, some have user controls on them.
In the main form I check that a file exists, if not then I want to close the application.
Using Application.Exit(); doesn't seem to work.
What is the best way to close everything and exit

Closing forms and controls
mahima
razored
No in fact no other forms are loaded at this point.
this is my code:
public frmMain(){
InitializeComponent();
//Set all the global variables this.fnSetGlobal();}
#region
Form //------------------------------------------------------ private void frmMain_Load(object sender, EventArgs e){
//Show the Developer name this.tsDeveloper.Text = GlobalVars.GV._Developer; //Show the Version this.tsVersion.Text = GlobalVars.GV._Version; //Create a new instance of the Login Form frmLogIn chFormD = new frmLogIn(this ); //Display the child LoginchFormD.ShowDialog(
this); //Set the header of this form as choosen in the Login Form switch (GlobalVars.GV._SelectedCompany){
case "1": this.tsCompany.Text = GlobalVars.GV._CompanyName1; break; case "2": this.tsCompany.Text = GlobalVars.GV._CompanyName2; break;}
}
#endregion
Form#region
Control-Q //------------------------------------------------------- private void QuotestoolStripMenuItem1_Click(object sender, EventArgs e){
switch (GlobalVars.GV._SelectedCompany){
case "1": //Create a new instance of the MDI child Quotations frmQuotations chFormQ = new frmQuotations(); //Display the child windowchFormQ.ShowDialog(
this); break; case "2": //To Do break;}
}
private void AbouttoolStripMenuItem2_Click(object sender, EventArgs e){
//Create a new instance of the MDI child Quotations frmAbout chFormA = new frmAbout(); //Display the about formchFormA.ShowDialog();
}
#endregion
Control-Q //------------------------------------------------------- private void fnSetGlobal(){
//Set the global variables}
else{
MessageBox.Show("Cannot connect to config"); Application.Exit();}
}
Suresh Venkatraman