Odd error trapping

  • Thread starter Thread starter Jon
  • Start date Start date
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)
 
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).
 
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).
 
Back
Top