Y
Young
Instead of handling exception in each function/sub, I would like to pass the
exception to a sub and get it to handle all exceptions. Here's where I try
to do:
Try
.....
Catch Ex as Exception
Call HandleEx(Ex) ' HandleEx is the sub
end try
Here's HandleEx:
Sub HandleEx(Ex as Exception)
dim msg as string
msg = Ex.Message
Msgbox (Msg) ' This works.
end sub
How can I get the exception type within HandleEx? What I am trying to do is
this:
Sub HandleEx(Ex as Exception)
If TypeOf Ex Is System.ArgumentException Then
ElseIf TypeOf Ex Is System.IO.FileNotFoundException then
Endif
end sub
The above works but I can I do it in a Select Case statement instead of use
If TypeOf Ex Is?
Please Help.
Thanks
Young
exception to a sub and get it to handle all exceptions. Here's where I try
to do:
Try
.....
Catch Ex as Exception
Call HandleEx(Ex) ' HandleEx is the sub
end try
Here's HandleEx:
Sub HandleEx(Ex as Exception)
dim msg as string
msg = Ex.Message
Msgbox (Msg) ' This works.
end sub
How can I get the exception type within HandleEx? What I am trying to do is
this:
Sub HandleEx(Ex as Exception)
If TypeOf Ex Is System.ArgumentException Then
ElseIf TypeOf Ex Is System.IO.FileNotFoundException then
Endif
end sub
The above works but I can I do it in a Select Case statement instead of use
If TypeOf Ex Is?
Please Help.
Thanks
Young