|
-
May 11th, 2003, 03:00 PM
#1
Thread Starter
Frenzied Member
error trapping
I hate to bring up the issue of the Exit Sub Procedure...it seems to be a touchy topic in here...but here goes...
in a Try, Catch structure will the code always go to Finally? Even if there is an Exit Sub in the Catch portion?
My question is pertaining to closing a connection?
thanks
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
May 11th, 2003, 03:13 PM
#2
Hyperactive Member
Try it
VB Code:
Public Sub DivideByZero()
Dim x As Long
Dim y As Long = 0
Try
x = 2 \ y
Catch eg As Exception
Exit Sub
Finally
MsgBox("Got Finally executed ))")
End Try
End Function
Wrote it on the fly...
Learn, this is the Keyword...
-
May 11th, 2003, 03:17 PM
#3
Thread Starter
Frenzied Member
if you dont have the exit sub in the catch portion...will the code still run through the rest of the procedure?
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
May 11th, 2003, 03:24 PM
#4
Hyperactive Member
If you don't have the Exit Sub statement it will go...
Learn, this is the Keyword...
-
May 11th, 2003, 03:26 PM
#5
Sleep mode
MSDN
An "enabled" error handler is one that is turned on by an On Error statement; an "active" error handler is an enabled handler that is in the process of handling an error. If an error occurs while an error handler is active (between the occurrence of the error and a Resume, Exit Sub, Exit Function, or Exit Property statement), the current procedure's error handler can't handle the error.
-
May 11th, 2003, 05:19 PM
#6
Hyperactive Member
Pirate: What do you mean?
VB Code:
Public Sub DivideByZero()
Dim x As Long
Dim y As Long = 0
Try
x = 2 \ y
Catch eg As Exception
'Here errors can't be handled unless another try statement?
' x= 2 \ y throws an error!!!
Finally
MsgBox("Got Finally executed ))")
End Try
End Function
Sure is that what you mean...
Learn, this is the Keyword...
-
May 12th, 2003, 09:00 AM
#7
Fanatic Member
If you cause an error in your catch block then it will be unhandled unless you have it in its own try block.
-
May 12th, 2003, 10:21 AM
#8
Finally ALWAYS will fire wether you get an error or not, and yes it will fire off before you 'Return'/Exit Sub! (Use Return )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|