B
BMC
When starting up, my app needs to pull some information out of a
database, which it does. It also needs to quit if the SQL query returns
no data.
All the database checking stuff is in a private void that is called
right after the InitializeComponent() on the form.
The code in that function that determines that it should quit is this:
if (!reader.HasRows)
{
MessageBox.Show("Unknown user.");
Application.Exit();
}
Now when that criteria is met, the message box shows but the application
doesn't quit. If I run that same function by e.g. attaching it to the
click event of something, it does work and shut the application down.
Any ideas what I might be doing wrong here?
database, which it does. It also needs to quit if the SQL query returns
no data.
All the database checking stuff is in a private void that is called
right after the InitializeComponent() on the form.
The code in that function that determines that it should quit is this:
if (!reader.HasRows)
{
MessageBox.Show("Unknown user.");
Application.Exit();
}
Now when that criteria is met, the message box shows but the application
doesn't quit. If I run that same function by e.g. attaching it to the
click event of something, it does work and shut the application down.
Any ideas what I might be doing wrong here?