Hello,
I have a database application with error handling in a separate module.
vb Code:
... ' EDIT A RECORD With currentCustomer .Address = txtAddress.Text .ContactDate = dtpContactDate.Value 'etc... End With ' SAVE Try Db.SubmitChanges() Me.Close() Catch ex As Exception MessageBox.Show(ex.Message) End Try
I have defined validation code in a partial class:
vb Code:
Partial Public Class Customer Private Sub OnValidate(ByVal action As System.Data.Linq.ChangeAction) Select Case action Case ChangeAction.Update If Me.Address = Nothing Then Throw New Exception("Fill the Address!") End If 'etc...
But while debugging (and "Address" field is left empty), the program breaks and I get an exception at the "Throw New Exception" line even if the error should be trapped by the "Try...Catch" block.
At runtime, everything works well and the correct error is displayed.
What is happening?




Reply With Quote