G
Guest
Hi folks,
I have a simple form like this:
public class Blah: System.Windows.Forms.Form{
private OleDBConnection conn;
public class Blah(){
conn.ConnectionString = "... ....";
try{
conn.open();
}
catch(Exception e){
Application.Exit(); <--- does not work
}
}
static void Main(){
Application.run(new Blar());
}
}
Problem:
1. When system fails to connection to SQL server, it catchs error and
executes Application.Exit(). But it does not work! After this line, it still
pops up the form.
Question:
1. How to terminate program properly when something goes wrong during system
loading?
Thanks,
Karl
I have a simple form like this:
public class Blah: System.Windows.Forms.Form{
private OleDBConnection conn;
public class Blah(){
conn.ConnectionString = "... ....";
try{
conn.open();
}
catch(Exception e){
Application.Exit(); <--- does not work
}
}
static void Main(){
Application.run(new Blar());
}
}
Problem:
1. When system fails to connection to SQL server, it catchs error and
executes Application.Exit(). But it does not work! After this line, it still
pops up the form.
Question:
1. How to terminate program properly when something goes wrong during system
loading?
Thanks,
Karl