P
Peter Huang
Hi Brian,
Thanks for posting in the community.
Module Module3
Public Function Func(ByVal isEx As Boolean) As Boolean
Try
Console.WriteLine("Try Block")
If isEx Then
Throw New Exception("Throw Error")
End If
Func = True
Catch ex As Exception
Console.WriteLine("Catch Block:" + ex.Message)
Func = False
Finally
Console.WriteLine("Finally Block")
End Try
Console.WriteLine("This line of code will not be run")
End Function
Public Sub Main()
Console.WriteLine(Func(True))
Console.WriteLine()
Console.WriteLine(Func(False))
End Sub
End Module
If you did not use the return statement, then the code below will be
executed.
Console.WriteLine("This line of code will not be run")
I have added an comment at the end of the code, Console.WriteLine("This
line of code will not be run") will be executed.
I am sorry if I did not change the text in the writeline.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Thanks for posting in the community.
Module Module3
Public Function Func(ByVal isEx As Boolean) As Boolean
Try
Console.WriteLine("Try Block")
If isEx Then
Throw New Exception("Throw Error")
End If
Func = True
Catch ex As Exception
Console.WriteLine("Catch Block:" + ex.Message)
Func = False
Finally
Console.WriteLine("Finally Block")
End Try
Console.WriteLine("This line of code will not be run")
End Function
Public Sub Main()
Console.WriteLine(Func(True))
Console.WriteLine()
Console.WriteLine(Func(False))
End Sub
End Module
If you did not use the return statement, then the code below will be
executed.
Console.WriteLine("This line of code will not be run")
I have added an comment at the end of the code, Console.WriteLine("This
line of code will not be run") will be executed.
I am sorry if I did not change the text in the writeline.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.