﻿<?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?)  » Error in child BO when clicking Edit button in SF toolstrip</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 11:25:52 GMT</lastBuildDate><ttl>20</ttl><item><title>Error in child BO when clicking Edit button in SF toolstrip</title><link>http://forum.strataframe.net/FindPost15137.aspx</link><description>Here is the error: &lt;P&gt;[quote]BusinessLayerException&lt;BR&gt;&amp;nbsp; There are no rows in the current data table.&amp;nbsp; An edit is not allowed.&lt;/P&gt;&lt;P&gt;Source&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : MicroFour StrataFrame Business&lt;/P&gt;&lt;P&gt;Stack Trace: &lt;BR&gt;&amp;nbsp;&amp;nbsp; at MicroFour.StrataFrame.Business.BusinessLayer.Edit(Boolean CheckSecurity)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Edit(Boolean CheckSecurity)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at MicroFour.StrataFrame.UI.Windows.Forms.MaintenanceFormToolStrip.cmdEdit_Click(Object sender, EventArgs e)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.WmMouseUp(Message&amp;amp; m, MouseButtons button, Int32 clicks)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.WndProc(Message&amp;amp; m)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ToolStrip.WndProc(Message&amp;amp; m)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.ControlNative&amp;#119;indow.WndProc(Message&amp;amp; m)&lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Native&amp;#119;indow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)&lt;BR&gt;[/quote] &lt;P&gt;I have a form with 2 BO, when I click Edit button and there is no child record, I got the error above.&amp;nbsp; The child BO has the following properties set to True: IncludeInFormEdit, IncludeInFormSave and IncludeInFormUndo, the rest include... properties are set to False. &lt;P&gt;I have been searching the help file and this forum but have not find a way to prevent this error.&amp;nbsp; I was under the impression that the Edit code will check if there is not record in the child BOs and skip the edit state on those BO?</description><pubDate>Mon, 24 Mar 2008 17:22:23 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Error in child BO when clicking Edit button in SF toolstrip</title><link>http://forum.strataframe.net/FindPost15150.aspx</link><description>[quote]Well, I am using a ListView here but I don't think that will makes any difference.[/quote]&lt;/P&gt;&lt;P&gt;You are correct in that it won't make a difference.&amp;nbsp; As I mentioned, the EditMode really only pertains to the UI editing state.&amp;nbsp; This is used to create synchrony between the UI controls and the MaintenanceFormToolstrip, etc.&amp;nbsp; This is good for a primary BO, but downstream (child) BOs that appear on another form will not matter in this case.</description><pubDate>Mon, 24 Mar 2008 17:22:23 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Error in child BO when clicking Edit button in SF toolstrip</title><link>http://forum.strataframe.net/FindPost15147.aspx</link><description>[quote]We have developers that have gone down this road, but having a single MaintenanceFormToolstrip that tries to do it all...well...you are going to have troubles.[/quote]&lt;P&gt;No a problem, I did not have that functionality before in VFP so there is nothing to miss :P, basically I am just exploring what can/can't do with SF, and though I could have saved some time by letting the MaintenanceFormToolstrip handle some of the child BO behavior.&amp;nbsp; I will fix this to use the MaintenanceFormToolstrip the proper way and manually handle the child BO Add/Remove/Save.&lt;/P&gt;&lt;P&gt;[quote]I really don't know why you are so concerned with the Editmode anyway.&amp;nbsp; I see that you are using a grid...as soon as a field changes, the BO will updated...the editing state is primarly (if not exclusively) used for managing the UI field states...nothing more.[/quote]&lt;/P&gt;&lt;P&gt;Well, I am using a ListView here but I don't think that will makes any difference.&lt;/P&gt;&lt;P&gt;[quote] If you REALLY want to know whether a field has been added, modified, etc, you will want to look at the RowState of the CurrentRow obejct:&lt;/P&gt;&lt;P&gt;[codesnippet]MyBo.CurrentRow.RowState[/codesnippet][/quote]&lt;P&gt;Thanks will do so.</description><pubDate>Mon, 24 Mar 2008 16:39:53 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Error in child BO when clicking Edit button in SF toolstrip</title><link>http://forum.strataframe.net/FindPost15146.aspx</link><description>[quote]From SF design view, does it make sense to handle the child BO this way?[/quote]&lt;/P&gt;&lt;P&gt;Not really.&amp;nbsp; We have developers that have gone down this road, but having a single MaintenanceFormToolstrip that tries to do it all...well...you are going to have troubles.&amp;nbsp; This partially goes back to the post I made the other day about the changes I made to a listview...it will autonavigate when a record is selected.&amp;nbsp; But that aside, it is really dangerous, SF or not, to rely on that one navigation object to keep all of your BOs in sync.&amp;nbsp; &lt;/P&gt;&lt;P&gt;[quote]Would it be an easy way to prevent the error above by checking the BO.Count = 0 and canceling the Edit for the child BO?&lt;/P&gt;&lt;P&gt;[/quote]&lt;/P&gt;&lt;P&gt;I really don't know why you are so concerned with the Editmode anyway.&amp;nbsp; I see that you are using a grid...as soon as a field changes, the BO will updated...the editing state is primarly (if not exclusively) used for managing the UI field states...nothing more.&amp;nbsp; If you REALLY want to know whether a field has been added, modified, etc, you will want to look at the RowState of the CurrentRow obejct:&lt;/P&gt;&lt;P&gt;[codesnippet]MyBo.CurrentRow.RowState[/codesnippet]</description><pubDate>Mon, 24 Mar 2008 16:25:17 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Error in child BO when clicking Edit button in SF toolstrip</title><link>http://forum.strataframe.net/FindPost15141.aspx</link><description>Hi Trent, &lt;P&gt;Basically this is a form that will handle a One2Many relation (see image below) &lt;P&gt;&lt;IMG src="http://forum.strataframe.net/Uploads/Images/d8795ca6-0ce4-4937-865b-8965.png"&gt; &lt;P&gt;At this stage I am trying to set my basis for all forms using the same type of OTM relation.&amp;nbsp; As you can see, I am handling the Add/Remove service (child BO) with the 2 buttons below.&amp;nbsp; Initially I though of using another ToolStrip for the child BO but then will need to add code to handle all buttons navigation.&amp;nbsp; By using the "Include..." properties I noticed that the Edit/Save/Undo of the main ToolStrip will take care of the child BO and everything is working just fine, except for this error I got testing with no data in the child BO. &lt;P&gt;I have some questions about this situation: &lt;OL&gt;&lt;LI&gt;From SF design view, does it make sense to handle the child BO this way?&lt;/LI&gt;&lt;LI&gt;Would it be an easy way to prevent the error above by checking the BO.Count = 0 and canceling the Edit for the child BO?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Thanks!</description><pubDate>Mon, 24 Mar 2008 15:45:19 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Error in child BO when clicking Edit button in SF toolstrip</title><link>http://forum.strataframe.net/FindPost15139.aspx</link><description>[quote]I have been searching the help file and this forum but have not find a way to prevent this error.&amp;nbsp; I was under the impression that the Edit code will check if there is not record in the child BOs and skip the edit state on those BO?[/quote]&lt;/P&gt;&lt;P&gt;No.&amp;nbsp; If you have the IncludeInEdit set to True, which there is really no reason to, then it will call the Edit on the BO.&amp;nbsp; If there are no records then you will get this error.&amp;nbsp; This is by design.&lt;/P&gt;&lt;P&gt;I never allow the MaintenanceFormToolstrip automatically set the Edit state of a child BO, only the primary.&amp;nbsp; Obviously you want actions such as Save and Undo to handle all BOs, but in this case, unless you will always expect a child, then there is no reason to do this.&amp;nbsp; Additionally, if you are using a ChildFormDialog to present the child record for editing, then you would set the Editing state then (immediately prior to showing the child dialog).&lt;/P&gt;&lt;P&gt;There are other options too such as always allowing modifiction by setting the ManageUIReadonlyState property to False and then manage the IsDirtyChanged event.&amp;nbsp; Just another approach. &lt;/P&gt;&lt;P&gt;But this is be design...the Editing state is by business object, not row.&amp;nbsp; So it only makes sense that a BO with no records should not be allowed to be set to an Editing state.&amp;nbsp; If we were to ignore this and just set it anyway, then this would have adverse downstream effects.</description><pubDate>Mon, 24 Mar 2008 15:14:27 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>