I'm creating some software in visual basic 2005 .Net. My software keeps a log file. If the applications encounters an error, it writes to this log file. Is there a way I can easily produce what sub, function, or block of code that produced the error?

Example:
Sub MessageUser()
Try
msbox("Hello")
Catch
msgbox("I want to be able to know MessageUser is the sub that encountered the error.")
End try

End Sub

Since msgbox is spelled incorrectly this will produce an error. I want to know what sub caused the error, in this case MessageUser.