I am trying to trap a save error for example instead of StrataFrame responding with its own error box for having a duplicate record. I would like to trap this and display my own message box notifying the user what is needed to be able to save.
I tried to use this code in the business object without any success. I put a break point to see if it stops and it does not. Please tell me where I am going wrong.
Thanks
Public Overrides Function Save(ByVal b As Boolean) As MicroFour.StrataFrame.Data.SaveUndoResult
Dim r As MicroFour.StrataFrame.Data.SaveUndoResultr = MyBase.Save(b)Throw New ApplicationException()End SelectEnd If
Dim r As MicroFour.StrataFrame.Data.SaveUndoResult
r = MyBase.Save(b)
Throw New ApplicationException()
End Select
End If
End Function
What you probably want to do is set the business object's ErrorSavingMode to ContinueOnError (it defaults to FailOnError and throws exceptions when saving). That way, you could handle the ErrorSaving event on the business object and show your message inside of that event handler.
The other option would be to wrap the MyBase.Save() call in your overriden method with a Try/Catch. In the Catch, show your message.