I am using a way of making error messages, and it works fine. It is just starting to get a little annoying as my project gets larger.
I was wondering if there was a way to do with with out having to rename every part of the error, and make a code so it would pick up the function it occurred in.
Private Sub tsbEditNeighbour_Click(sender As Object, e As EventArgs) Handles tsbEditNeighbour.Click
' Error Checking
On Error GoTo Err_tsbEditNeighbour_Click
Dim CurrentRow As DataRowView = TryCast(PropertyNeighboursLoadRecordsBindingSource.Current, DataRowView)
' Load Warranty
Dim uNeighbours As New frmNeighbours
With uNeighbours
.PropertyID = Val(lblPropertyIDValue.Text)
.NeighbourID = Val(CurrentRow("NeighbourID"))
.LoadNeighbours()
.ShowDialog()
Me.Show()
End With
Err_tsbEditNeighbour_Click:
If Err.Number <> 0 Then
sErrDescription = Err.Description
WriteAuditLogRecord(Me.Name, "tsbEditNeighbour_Click", "Error", sErrDescription)
MsgBox("System Error occurred" & Chr(13) & "tsbEditNeighbour_Click" & Chr(13) & sErrDescription, MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "AztecCRM - Error Reporting")
End If
End Sub