﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Trap Save Error  and respond with a message box</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 01:38:48 GMT</lastBuildDate><ttl>20</ttl><item><title>Trap Save Error  and respond with a message box</title><link>http://forum.strataframe.net/FindPost12927.aspx</link><description>Hi &lt;/P&gt;&lt;P&gt;I am trying to trap a save error&amp;nbsp;&amp;nbsp; for example&amp;nbsp; 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.&lt;/P&gt;&lt;P&gt;I tried to use this code in the business object without any success.&amp;nbsp; I put a break point to see if it stops and it does not. Please tell me where I am going wrong.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;Public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;&lt;FONT class=SearchHighlight&gt;Override&lt;/FONT&gt;s&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Function&lt;/FONT&gt; &lt;FONT class=SearchHighlight&gt;Save&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; b &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Boolean&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; MicroFour.StrataFrame.Data.&lt;FONT class=SearchHighlight&gt;Save&lt;/FONT&gt;UndoResult&lt;/P&gt;&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; r &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; MicroFour.StrataFrame.Data.&lt;FONT class=SearchHighlight&gt;Save&lt;/FONT&gt;UndoResult&lt;/P&gt;&lt;P&gt;r = &lt;FONT color=#0000ff&gt;MyBase&lt;/FONT&gt;.&lt;FONT class=SearchHighlight&gt;Save&lt;/FONT&gt;(b)&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;Throw&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; ApplicationException()&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Select&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;If&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Function&lt;/FONT&gt;</description><pubDate>Fri, 07 Dec 2007 09:12:17 GMT</pubDate><dc:creator>Mike Rogers</dc:creator></item><item><title>RE: Trap Save Error  and respond with a message box</title><link>http://forum.strataframe.net/FindPost12935.aspx</link><description>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.&lt;/P&gt;&lt;P&gt;What you probably want to do is set the business object's ErrorSavingMode to ContinueOnError (it defaults to FailOnError and throws exceptions when saving).&amp;nbsp; That way, you could handle the ErrorSaving event on the business object and show your message inside of that event handler.&lt;/P&gt;&lt;P&gt;The other option would be to wrap the MyBase.Save() call in your overriden method with a Try/Catch.&amp;nbsp; In the Catch, show your message.&amp;nbsp;</description><pubDate>Fri, 07 Dec 2007 09:12:17 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Trap Save Error  and respond with a message box</title><link>http://forum.strataframe.net/FindPost12928.aspx</link><description>I add a event to the tool bar of the form. Now I get the business object stepping thru the code.&amp;nbsp; But how do I turn off the Strata Frame error message now.</description><pubDate>Fri, 07 Dec 2007 00:41:27 GMT</pubDate><dc:creator>Mike Rogers</dc:creator></item></channel></rss>