Trap Save Error and respond with a message box


Author
Message
Mike Rogers
Mike Rogers
StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)
Group: Forum Members
Posts: 23, Visits: 723
Hi

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.SaveUndoResult

r = MyBase.Save(b)

Throw New ApplicationException()

End Select

End If

End Function

Mike Rogers
Mike Rogers
StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)
Group: Forum Members
Posts: 23, Visits: 723
I add a event to the tool bar of the form. Now I get the business object stepping thru the code.  But how do I turn off the Strata Frame error message now.
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The reason the StrataFrame error is being shown is that the MyBase.Save() call is throwing an exception and you're not catching it, so it's being handled by the StrataFrameApplication object.

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. 

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search