TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dferguson32
NA
3
0
Closing Application on Error
Nov 27 2003 7:14 AM
In the constructor of my initial windows form class I would like to do some set up of various parameters. If errors occur during this setup I would like an error message to appear and the entire application to end. Unfortunately, the initial form appears and must be closed. I have tried adding a close() in the constructor but probably because the form has not been shown at this point this doesn't work. Some code snippets are as follows. Any ideas? TIA static void Main() { Application.Run(new Master()); } public class Master : System.Windows.Forms.Form { InitializeComponent(); // test new data Access class try { da = new DataAccess(); } catch (Exception err) { MessageBox.Show(err.ToString()); Close(); // note: doesn't work return; // returns but form is still displayed } ..... }
Reply
Answers (
2
)
Balloon tips
CrystalReport.Net - Query Engine Error