I'm working on my 3rd .net app and I love the Try/Catch error handling. Much better than On Error Goto. I'm wondering how others trap expected errors that you may want to ignore or deal with other than bailing out of the routine. Right now I'm checking the ex.Message, and it works, but in the past (VB6 and before) I always checked for an error number. String literals seem odd, but it does make for nice documentation of the code. After looking at the different properties and methods nothing really jumps out at me.
VB.NET:
Try
'some code here
Catch ex As Exception When ex.Message = "Error Message Text."
Exit Do
Catch ex As Exception When ex.Message = "Another Error Message Text."
If MsgBox("Known error blah, blah, blah. Do you want to continue?",
MsgBoxStyle.YesNo, "Error Message") = MsgBoxResult.No Then
Exit Sub
End If
Catch ex As Exception 'Something unknown happened
MsgBox(ex.Message)
Exit Sub
End Try