﻿<?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?)  » The Navigating event and Adding a record</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sun, 05 Apr 2026 11:45:35 GMT</lastBuildDate><ttl>20</ttl><item><title>The Navigating event and Adding a record</title><link>http://forum.strataframe.net/FindPost7720.aspx</link><description>I am reacting to the Navigating event of a BO, to see if it is dirty and then allow the user to handle it if it is dirty.  It appears to be raised AFTER the new row is added but before it is navigated to.  The code I'm using in the Navigating event is:&lt;br&gt;
&lt;br&gt;
[codesnippet]If e.BusinessObject.IsDirty Then&lt;br&gt;
' Confirm message&lt;br&gt;
'...setup MessageItem so we can use MessageForm() to get result&lt;br&gt;
&lt;br&gt;
Select Case MessageForm.ShowMessage(msgItem)&lt;br&gt;
  Case MessageFunctionType.Yes&lt;br&gt;
    e.BusinessObject.Save()&lt;br&gt;
  Case MessageFunctionType.No&lt;br&gt;
    e.BusinessObject.Undo(CurrentRowOnly)&lt;br&gt;
  Case MessageFunctionType.Cancel&lt;br&gt;
    ' Cancel nav and any thing else to reset UI&lt;br&gt;
    e.Cancel = True&lt;br&gt;
End Select&lt;br&gt;
&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
The problem is that when I click a button that calls the Add() method of the BO.  This then calls the Navigating event handler (at some point) after the new record is added (which I guess makes sense).  If the editing state of the BO is idle (not editing anything when Add() was called), the BO is dirty already.  This then blows up because there is nothing to save or undo and canceling cancels the navigation to the new record!  I'm not sure how to handle the case of a new record.  Ideas? &lt;br&gt;
&lt;br&gt;
I'm doing it this way because I have a listbox that allows the user to view all available records and navigate via the listbox.</description><pubDate>Mon, 26 Mar 2007 18:36:51 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item></channel></rss>