Odd error trapping

J

Jon

It appears that application.exit isn't doing what I think it should be
doing. The line oRpt.SetupReportDatabase() causes an except and the
exception is caught and the messagebox with the error message pops up, as it
should. However, the application does not exit, and the MsgBox("Making
params") is executed from the next block of code and execution continues on.
Am I doing something wrong? Shouldn't application.exit immediately stop the
program. Thanks for any insight!

I have the following code:

Try
MsgBox("Enter create report")
oRpt = New MSIReporting.MSICrystal(strNewReport,
DBName, AppSettings("WOServer"), AppSettings("WOLogin"),
AppSettings("WOPassword"))

MsgBox("Exit create report")

MsgBox("Set up report DB")
oRpt.SetupReportDatabase(DBName,
AppSettings("WOServer"), AppSettings("WOLogin"), AppSettings("WOPassword"))
MsgBox("Done report db")
Catch ex As Exception
MsgBox("APPEXIT " + ex.Message)

Application.Exit()
End Try

Try
MsgBox("Making params")

ReDim oCRParamsName(1, 1)
oCRParamsName(0, 0) = "WO"
oCRParamsName(0, 1) = drRow(3)
 
G

Guest

No. Application.Exit just signals the message loop for the current
application to terminate. The loop can't terminate until you return control
to it. Try adding an Exit Sub after the Application.Exit so you can return
control back to the caller. (I assume this code is inside some Click event
handler or such).
 
J

Jon

Thanks a bunch!


TrtnJohn said:
No. Application.Exit just signals the message loop for the current
application to terminate. The loop can't terminate until you return
control
to it. Try adding an Exit Sub after the Application.Exit so you can
return
control back to the caller. (I assume this code is inside some Click
event
handler or such).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top