Just add multiple catch statements:
<Code Snippet = VB.NET>
Dim a As Integer = 1
Dim b As Integer = 0
Dim y As Integer
Try
y = a\b
Catch y As DivideByZeroException
Debug.Writeline("DBZ")
Catch x As Exception
Debug.Writeline("Exception")
Finally
End Try
</Code Snippet>
Will catch on the first catch. . .Any other exceptions will be caught by the second. .
.
Jacob A. Grass
> -----Original Message-----
> From: Jeff Roberts [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 04, 2002 8:36 AM
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] try catch question
>
>
> Is it possible to catch more than 1 type of exception ? I am
> calling a method that can throw different types of
> exceptions, how do I catch them all ?
>
> You can read messages from the DOTNET archive, unsubscribe
> from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.