﻿<?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?)  » ChildForm with child BO and Broken Rules....</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 00:18:05 GMT</lastBuildDate><ttl>20</ttl><item><title>ChildForm with child BO and Broken Rules....</title><link>http://forum.strataframe.net/FindPost16065.aspx</link><description>Hi,&lt;/P&gt;&lt;P&gt;I have a ListView which calls a ChildForm with a child BO which I would like to control the saving and broken rules on the childform.&amp;nbsp; I have the following code in the Save button of my ChildForm:&lt;/P&gt;&lt;P&gt;[quote][codesnippet]&lt;FONT size=2&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;Sub&lt;/FONT&gt;&lt;FONT size=2&gt; cmdSave_Click(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; sender &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; System.Object, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; e &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; System.EventArgs) &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Handles&lt;/FONT&gt;&lt;FONT size=2&gt; cmdSave.Click&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.PolicyBO1.Save() = MicroFour.StrataFrame.Data.SaveUndoResult.Success &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me&lt;/FONT&gt;&lt;FONT size=2&gt;.DialogResult = Windows.Forms.DialogResult.OK&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me&lt;/FONT&gt;&lt;FONT size=2&gt;.PolicyBO1.Undo(MicroFour.StrataFrame.Business.BusinessUndoType.CurrentRowOnly)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me&lt;/FONT&gt;&lt;FONT size=2&gt;.DialogResult = Windows.Forms.DialogResult.Cancel&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;[/codesnippet][/quote]&lt;/P&gt;&lt;P&gt;The problem is that the broken rules are not shown in the form and the form is released, but in the parent form the childbo state is Editing.&lt;/P&gt;&lt;P&gt;How can I accomplish having control on the ChildForm to Save/Undo the data and when returning to the Parent Form not worrying about the childBO state?</description><pubDate>Thu, 01 May 2008 10:30:07 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: ChildForm with child BO and Broken Rules....</title><link>http://forum.strataframe.net/FindPost16067.aspx</link><description>[quote][b]Trent L. Taylor (05/01/2008)[/b][hr]You are generally always better of only saving records from a single location...for example, the parent form.[/quote] &lt;P&gt;In this case, the Parent form will manage 1 child BO and this will manage another child BO and this another one. That is the reason I prefer to manage the save in each ChildForm. &lt;P&gt;I tried MyBo.CheckRules(True) and it worked but it did not show the Infobox, then I found another message in the forum suggesting to use the form's Save() &lt;A href="http://forum.strataframe.net/Topic6212-6-1.aspx"&gt;http://forum.strataframe.net/Topic6212-6-1.aspx&lt;/A&gt;&amp;nbsp;so I endup with the code below which so far give me the functionality I want when calling the ChildForm via the new enhanced ListView: &lt;P&gt;[quote][codesnippet]&lt;FONT size=2&gt; &lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.Save() &amp;lt;&amp;gt; MicroFour.StrataFrame.Data.SaveUndoResult.Success &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ElseIf&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.Save() = MicroFour.StrataFrame.Data.SaveUndoResult.Success &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.DialogResult = Windows.Forms.DialogResult.OK&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Else&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.PolicyBO1.Undo(MicroFour.StrataFrame.Business.BusinessUndoType.CurrentRowOnly)&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.DialogResult = Windows.Forms.DialogResult.Cancel&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;[/codesnippet][/quote] &lt;P&gt;Thanks for your recommendations!</description><pubDate>Thu, 01 May 2008 10:30:07 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: ChildForm with child BO and Broken Rules....</title><link>http://forum.strataframe.net/FindPost16066.aspx</link><description>You are generally always better of only saving records from a single location...for example, the parent form.&amp;nbsp; But in any case, you could do this to check the rules:&lt;P&gt;[codesnippet]If MyBo.CheckRules(True) Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DialogResult = OK&lt;BR&gt;End If[/codesnippet]&lt;P&gt;Then on the Parent form you will look to see what the results of the Dialog were and take appropriate action.&amp;nbsp; If you are using the ListView then handle the ChildFormResults event, but if you are calling the ChildFormDialog directly, the logic would be the same, but just be wrapped around the ShowDialog.&lt;P&gt;[codesnippet]If MyChildDialog.ShowDialog() = OK Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Reload the list view, for example&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lstMyList.Requery()&lt;BR&gt;Else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Undo the changes&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyChildBo.Undo(CurrentRowOnly)&lt;BR&gt;End If[/codesnippet]&lt;P&gt;It would look something like that.</description><pubDate>Thu, 01 May 2008 09:35:36 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>