﻿<?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 » WinForms (How do I?)  » Adding or Editing put me into an infinite loop</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 09:06:07 GMT</lastBuildDate><ttl>20</ttl><item><title>Adding or Editing put me into an infinite loop</title><link>http://forum.strataframe.net/FindPost19116.aspx</link><description>Hi All.&lt;/P&gt;&lt;P&gt;Me again. I have a form that is using the Browse Dialog to locate records. This form also has a DataGridView that holds the contacts for the current Advisor. This Code works fine:&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; brwAdvisor_BrowseDialogClosed(MicroFour.StrataFrame.UI.Windows.Forms.&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;BrowseDialogClosedEventArgs&lt;/FONT&gt;&lt;FONT size=2&gt; e)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// Get all the contacts for the currrent Advisor&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;boAdvisorContacts.GetAdvisorContacts(boAdvisor.advisor_pk);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;However, when these 2 methods are left uncommented, they put me into an infinite loop - any ideas about why this is happening? I have another form that uses similar code to update the child records in the grid and there are no problems with it - the only difference between the two forms is that the one that works does not use the Browse Dialog. Here are the methods that are causing the problems:&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; Advisors_FormNavigated(MicroFour.StrataFrame.Business.&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;NavigatedEventArgs&lt;/FONT&gt;&lt;FONT size=2&gt; e)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// Get all the contacts for the currrent Advisor&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;P&gt;// if (!boAdvisor.IsEmpty)&lt;/P&gt;&lt;P&gt;// boAdvisorContacts.GetAdvisorContacts(boAdvisor.advisor_pk);&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; Advisors_FormEditingStateChanged(MicroFour.StrataFrame.Business.&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;EditingStateChangedEventArgs&lt;/FONT&gt;&lt;FONT size=2&gt; e)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;P&gt;// if (!boAdvisor.IsEmpty)&lt;/P&gt;&lt;P&gt;// {&lt;/P&gt;&lt;P&gt;// if (boAdvisor.EditingState == MicroFour.StrataFrame.Business.BusinessEditingState.Idle)&lt;/P&gt;&lt;P&gt;// grdContacts.Enabled = false;&lt;/P&gt;&lt;P&gt;// else&lt;/P&gt;&lt;P&gt;// grdContacts.Enabled = true;&lt;/P&gt;&lt;P&gt;// }&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Fri, 05 Sep 2008 23:31:58 GMT</pubDate><dc:creator>Marcia G Akins</dc:creator></item><item><title>RE: Adding or Editing put me into an infinite loop</title><link>http://forum.strataframe.net/FindPost19149.aspx</link><description>[quote][b]Ben Chase (09/05/2008)[/b][hr][quote]Is there anywhere that I can find detailed information about the Strataframe's event model?&lt;P&gt;It could be that enabling the grid caused the IEditableObject.Edit() method to be called which would raise the EditingStateChanged, but setting the Enabled to true when it's already true shouldn't cause it to be called again.&amp;nbsp; :ermm:[/quote]&lt;P&gt;After my meeting with the client, I will try to track this one down and get back to you on what was going on. I meet with the client on Sep. 12th&amp;nbsp; so you will hear from me after that. Until next week, I am under the gun:w00t:</description><pubDate>Fri, 05 Sep 2008 23:31:58 GMT</pubDate><dc:creator>Marcia G Akins</dc:creator></item><item><title>RE: Adding or Editing put me into an infinite loop</title><link>http://forum.strataframe.net/FindPost19139.aspx</link><description>[quote]Is there anywhere that I can find detailed information about the Strataframe's event model?[/quote]&lt;/P&gt;&lt;P&gt;The help documentation has a list of events that exist on the business object and descriptions/examples of them.&amp;nbsp; As for the form events, they're listed, too, but almost every one of them is a mirror event of the BusinessLayer class.&amp;nbsp; The business object raises its event and the form follows suit.&amp;nbsp; I don't think we have a diagram in the help documentation.&amp;nbsp; There a diagram of the save process in the documentation for our training classes and it shows events, but that's about it.&lt;/P&gt;&lt;P&gt;[quote]Well all I know is what I observed :)[/quote]&lt;/P&gt;&lt;P&gt;It could be that enabling the grid caused the IEditableObject.Edit() method to be called which would raise the EditingStateChanged, but setting the Enabled to true when it's already true shouldn't cause it to be called again.&amp;nbsp; :ermm:</description><pubDate>Fri, 05 Sep 2008 17:03:17 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Adding or Editing put me into an infinite loop</title><link>http://forum.strataframe.net/FindPost19135.aspx</link><description>[quote][b]Ben Chase (09/05/2008)[/b][hr]The business objects fire their Navigated event when they are refilled.&amp;nbsp; So, your call to boAdvisorContacts.GetAdvisorContacts(boAdvisor.advisor_pk) looks like it's populating the boAdvisorContacts business object; at the end of that fill process, it will fire its Navigated event.&amp;nbsp; The form's Navigated event is a mirror of the Navigated event of all business objects on the form... any business object navigates, and it gets raised as well.&amp;nbsp; So, when you filled your business object, it Navigated, which caused the form to raise Navigated, which filled the business object again, which Navigated again, which caused the form to raise Navigated again, and so on.&amp;nbsp; When you want to&amp;nbsp;target&amp;nbsp;the navigation of a specific business object, then use the Navigated event of that specific business object; just like you figured out :)[/quote]&lt;/P&gt;&lt;P&gt;Thanks for the explanation. I appreciate it. Is there anywhere that I can find detailed information about the Strataframe's event model?&lt;/P&gt;&lt;P&gt;[quote][b]Ben Chase (09/05/2008)[/b][hr]As for the second handler on the EditingStateChanged, I'm not sure why that one would cause an infinite loop.&amp;nbsp; You're just enabling/disabling some UI elements, and not doing anything that would raise the EditingStateChanged again.[/quote]&lt;/P&gt;&lt;P&gt;Well all I know is what I observed:)</description><pubDate>Fri, 05 Sep 2008 16:55:09 GMT</pubDate><dc:creator>Marcia G Akins</dc:creator></item><item><title>RE: Adding or Editing put me into an infinite loop</title><link>http://forum.strataframe.net/FindPost19131.aspx</link><description>Yes, ma'am.&amp;nbsp; The business objects fire their Navigated event when they are refilled.&amp;nbsp; So, your call to boAdvisorContacts.GetAdvisorContacts(boAdvisor.advisor_pk) looks like it's populating the boAdvisorContacts business object; at the end of that fill process, it will fire its Navigated event.&amp;nbsp; The form's Navigated event is a mirror of the Navigated event of all business objects on the form... any business object navigates, and it gets raised as well.&amp;nbsp; So, when you filled your business object, it Navigated, which caused the form to raise Navigated, which filled the business object again, which Navigated again, which caused the form to raise Navigated again, and so on.&amp;nbsp; When you want to&amp;nbsp;target&amp;nbsp;the navigation of a specific business object, then use the Navigated event of that specific business object; just like you figured out :)&lt;/P&gt;&lt;P&gt;As for the second handler on the EditingStateChanged, I'm not sure why that one would cause an infinite loop.&amp;nbsp; You're just enabling/disabling some UI elements, and not doing anything that would raise the EditingStateChanged again.</description><pubDate>Fri, 05 Sep 2008 16:42:20 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Adding or Editing put me into an infinite loop</title><link>http://forum.strataframe.net/FindPost19117.aspx</link><description>Here I am talking to myself again :hehe:&lt;/P&gt;&lt;P&gt;I suppose that the only time I need to worry about it is if I start giving myself the wrong answers :)&lt;/P&gt;&lt;P&gt;The infinite recursion stopped when I moved the code to the corresponding boAdvisor event handlers. I have no idea why fixed the problem. Can anyone enlighten me?&lt;/P&gt;&lt;P&gt;Thanks</description><pubDate>Fri, 05 Sep 2008 12:07:02 GMT</pubDate><dc:creator>Marcia G Akins</dc:creator></item></channel></rss>