Aborting the program

  • Thread starter Thread starter Patrick De Ridder
  • Start date Start date
P

Patrick De Ridder

Given:

I call Form2 from Form1.
I throw an exception in Form2.
A MessageBox ("Fatal error") is shown with an OK button.

Question 1:

I want to abort everything after pressing the OK button.
How do I do this?

Question 2:

Alternatively, I want to return to Form1 after pressing the OK button.
How do I do this?
 
I would wrap your invocation of Form2 in a try/catch block:

try
{
Form2 theForm = new Form2();
theForm.Show();
}
catch (Exception ex)
{
// handle exception here
}
--------------------
From: Patrick De Ridder <[email protected]>
Newsgroups: microsoft.public.dotnet.languages.csharp
Subject: Aborting the program
Date: Fri, 01 Aug 2003 13:38:09 +0200
Organization: Planet Internet
Lines: 26
Message-ID: <[email protected]>
NNTP-Posting-Host: ipc379b760.dial.hetnet.nl
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: reader11.wxs.nl 1059738074 21152 195.121.183.96 (1 Aug 2003 11:41:14 GMT)
X-Complaints-To: (e-mail address removed)
NNTP-Posting-Date: 1 Aug 2003 11:41:14 GMT
X-Newsreader: Forte Agent 1.93/32.576 English (American)
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!newsfeed.freenet.de!eusc.inter.net!news.tele.dk!news.tele.dk!small.news
..tele.dk!newsfeed.multikabel.nl!newsfeed.wxs.nl!textnews.wxs.nl!not-for-mail
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:173520
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp


Given:

I call Form2 from Form1.
I throw an exception in Form2.
A MessageBox ("Fatal error") is shown with an OK button.

Question 1:

I want to abort everything after pressing the OK button.
How do I do this?

Question 2:

Alternatively, I want to return to Form1 after pressing the OK button.
How do I do this?

--
Any suggestions?


Many thanks,


--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
 
Back
Top