If you call this.Close() or Application.Exit() on a form in the contructor,
it won't close. If this form is the main form in your application, trying
loading your config settings in your Main() function, before you call
Application.Run(). Then, if you can't find the key, just don't call
Application.Run() and let your program finish before the form is ever
instantiated.
Chris
"Rajesh Abraham" <ch******@hotmail.com> wrote in message
news:0a****************************@phx.gbl...
I have a form, which is getting some settings from the
App.config in the form load. If the Key doesn't exist, I
need to close the application after trapping the error.
I tried Application.Exit() and Form.Close() neither seems
to be the right one.
Thanks,
Rajesh Abraham Chacko