﻿<?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?)  » Accessing a form from 2 different forms with 2 different child-dialogs</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 25 May 2026 15:00:28 GMT</lastBuildDate><ttl>20</ttl><item><title>Accessing a form from 2 different forms with 2 different child-dialogs</title><link>http://forum.strataframe.net/FindPost31695.aspx</link><description>Hi there,&lt;br/&gt;&lt;br/&gt;I&amp;nbsp;have a form which I want two call from two different forms with two different child-dialogs. Say teher is Form1 with a BO called "BestBo1". I Add a child-dialog, add&amp;nbsp;the same BO to the to-be-calles form and set the properties of the child-sialog. So far, so good.&lt;br/&gt;&lt;br/&gt;Now I need the same form for data-entry to called from another form woth a different BO. I do the same, add a child-dialog and the BO ("karteiBo1") and set the properties. I call the form with a new-sub where I pass a parameter to see what form is the parent-form.&lt;br/&gt;&lt;br/&gt;In the Load-Event I write something like&lt;br/&gt;&lt;br/&gt;[code]&lt;br/&gt;&lt;br/&gt;If me.cForm = "B"&amp;nbsp; ' Called from Form 1&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp; Me.PrimaryBusinessObject = BestBo1&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp; Me.txtKollege.Businessobject = BestBo1&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp; Me.txtkollege.BindingField ) BestBo1.Kollege&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp; ....' some more controls&lt;br/&gt;&lt;br/&gt;Else&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp; Me.PrimaryBusinessObject = KarteiBo1&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp; Me.txtKollege.Businessobject = KarteiBo1&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp; Me.txtkollege.BindingField ) KarteiBo1.Kollege&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp; ....' some more controls&lt;br/&gt;&lt;br/&gt;Endif&lt;br/&gt;&lt;br/&gt;[/code]&lt;br/&gt;&lt;br/&gt;But this does not wotk. Whether I call it from Form1 or Form2, I get an out-of-range-error.&lt;br/&gt;&lt;br/&gt;So can anyone tell me if I am doing something wrong or if that whole approach is wrong.&lt;br/&gt;&lt;br/&gt;Thanks in advance&lt;br/&gt;&lt;br/&gt;Thomas</description><pubDate>Thu, 10 Jan 2013 13:50:26 GMT</pubDate><dc:creator>Thomas Holste</dc:creator></item><item><title>RE: Accessing a form from 2 different forms with 2 different child-dialogs</title><link>http://forum.strataframe.net/FindPost31699.aspx</link><description>Hi Ben,&lt;br/&gt;&lt;br/&gt;thank you for your help. I found an error calling the child-form and now it almost works.&lt;br/&gt;&lt;br/&gt;Now as the form is loaded I have another question. As i wrote, I set the properties for the used controls in the load event, which mean that I set the Businessobject and the binding field. When I edit a record I expected the content of the fields to be shown but this happens only when I set the text property too (There are only textboxes on that form)- Is it right that I have to set the text-property too or did I miss something else?&lt;br/&gt;&lt;br/&gt;Best regards&lt;br/&gt;&lt;br/&gt;Thomas</description><pubDate>Thu, 10 Jan 2013 13:50:26 GMT</pubDate><dc:creator>Thomas Holste</dc:creator></item><item><title>RE: Accessing a form from 2 different forms with 2 different child-dialogs</title><link>http://forum.strataframe.net/FindPost31698.aspx</link><description>&lt;div&gt;&lt;font face="Verdana, Tahoma, Arial" size="2"&gt;&lt;span style="line-height: 21.33333396911621px;"&gt;Thomas,&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;div&gt;&lt;font face="Verdana, Tahoma, Arial" size="2"&gt;&lt;span style="line-height: 21.33333396911621px;"&gt;&lt;br/&gt;&lt;/span&gt;&lt;/font&gt;&lt;div&gt;&lt;font face="Verdana, Tahoma, Arial" size="2"&gt;&lt;span style="line-height: 21.33333396911621px;"&gt;What is the&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-color: rgb(249, 250, 252); font-family: Verdana, Tahoma, Arial; font-size: 13px; line-height: 21.33333396911621px;"&gt;Gal2G.KlarneuFRM.KlarneuFRM_Load() method doing on line 197. &amp;nbsp;The ChildFormDialog control will swap out the references on the control when you call ShowDialog() on it. &amp;nbsp;The Load event is called after the references have been swapped out, so it looks like you are trying to talk to the business object that was not swapped. &amp;nbsp;If you intend to use KarteiBO1, it gets swapped by the ChildFormDialog, but not the BestBO1, it will still be empty. &amp;nbsp;In your Load handler, can you wrap the line or lines with an "If Not BestBO1.IsEmty Then" test to skip using the BestBO1 if your form is using the KarteiBO1?&lt;/span&gt;</description><pubDate>Wed, 09 Jan 2013 14:12:48 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Accessing a form from 2 different forms with 2 different child-dialogs</title><link>http://forum.strataframe.net/FindPost31697.aspx</link><description>Hi,&lt;br/&gt;&lt;br/&gt;here it is:&lt;br/&gt;&lt;br/&gt;*******************&lt;br/&gt;&lt;br/&gt;BusinessLayerException&lt;br/&gt;&amp;nbsp; The CurrentRow for table '[dbo].[BEST]' could not be evaluated because the CurrentRowIndex is out of range.&amp;nbsp; Business object record count: 0.&amp;nbsp; CurrentRowIndex: -1.&lt;br/&gt;&lt;br/&gt;Source&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : MicroFour StrataFrame Business&lt;br/&gt;&lt;br/&gt;Stack Trace: &lt;br/&gt;&amp;nbsp;&amp;nbsp; bei MicroFour.StrataFrame.Business.BusinessLayer.get_CurrentRow()&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei GalileoBO.BestBO.get_KOLLEGE() in D:\vb_net\Gal2GL\GalileoBO\GalileoBO\BestBO.Designer.vb:Zeile 612.&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei Gal2G.KlarneuFRM.KlarneuFRM_Load(Object sender, EventArgs e) in D:\vb_net\Gal2GL\Gal2G\Gal2G\forms\KlarneuFRM.vb:Zeile 197.&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.EventHandler.Invoke(Object sender, EventArgs e)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Form.OnLoad(EventArgs e)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.OnLoad(EventArgs e)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Form.OnCreateControl()&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Control.CreateControl()&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Control.WmShowWindow(Message&amp;amp; m)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Control.WndProc(Message&amp;amp; m)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.ScrollableControl.WndProc(Message&amp;amp; m)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Form.WmShowWindow(Message&amp;amp; m)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Form.WndProc(Message&amp;amp; m)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Control.ControlNative&amp;#119;indow.OnMessage(Message&amp;amp; m)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Control.ControlNative&amp;#119;indow.WndProc(Message&amp;amp; m)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Native&amp;#119;indow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Control.SetVisibleCore(Boolean value)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Form.SetVisibleCore(Boolean value)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.SetVisibleCore(Boolean value)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Control.set_Visible(Boolean value)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Application.RunDialog(Form form)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Form.ShowDialog(IWin32Window owner)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Form.ShowDialog()&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei Gal2G.BestMainFRM.TSBKlartext_Click(Object sender, EventArgs e) in D:\vb_net\Gal2GL\Gal2G\Gal2G\forms\BestMainFRM.vb:Zeile 477.&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Control.WmMouseUp(Message&amp;amp; m, MouseButtons button, Int32 clicks)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.ToolStrip.WndProc(Message&amp;amp; m)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp;amp; msg)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei Gal2G.G2GStartfrm.ToolStripMenuItem1_Click(Object sender, EventArgs e) in D:\vb_net\Gal2GL\Gal2G\Gal2G\forms\G2GStartfrm.vb:Zeile 136.&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.ToolStripDropDown.WndProc(Message&amp;amp; m)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei System.Windows.Forms.Application.Run(Form mainForm)&lt;br/&gt;&amp;nbsp;&amp;nbsp; bei MicroFour.StrataFrame.Application.StrataFrameApplication.RunApplication()&lt;br/&gt;***********************************&lt;br/&gt;&lt;br/&gt;I should alos mention that I call this form to a record to the underlying BO (BestBO or KarteiBO)&lt;br/&gt;&lt;br/&gt;So later on I write&lt;br/&gt;&lt;br/&gt;[code]&lt;br/&gt;&lt;br/&gt;&lt;font face=Consolas&gt;&lt;/font&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;If&lt;/font&gt;&lt;/font&gt;&lt;font face=Consolas&gt; cForm = &lt;/font&gt;&lt;font color=#a31515 face=Consolas&gt;&lt;font color=#a31515 face=Consolas&gt;"B"&lt;/font&gt;&lt;/font&gt;&lt;font face=Consolas&gt; &lt;/font&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;Then&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face=Consolas&gt;BestBO1.Add()&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;Else&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face=Consolas&gt;KarteiBO1.Add()&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;End&lt;/font&gt;&lt;/font&gt;&lt;font face=Consolas&gt; &lt;/font&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;If&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face=Consolas&gt;&lt;/font&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;If&lt;/font&gt;&lt;/font&gt;&lt;font face=Consolas&gt; cForm = &lt;/font&gt;&lt;font color=#a31515 face=Consolas&gt;&lt;font color=#a31515 face=Consolas&gt;"B"&lt;/font&gt;&lt;/font&gt;&lt;font face=Consolas&gt; &lt;/font&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;Then&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face=Consolas&gt;BestBO1.Add()&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;Else&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face=Consolas&gt;KarteiBO1.Add()&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;End&lt;/font&gt;&lt;/font&gt;&lt;font face=Consolas&gt; &lt;/font&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;If&lt;/font&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;[/code]&lt;/font&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;Best regards &lt;/font&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;font color=#0000ff face=Consolas&gt;&lt;font color=#0000ff face=Consolas&gt;Thomas&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;/font&gt;</description><pubDate>Wed, 09 Jan 2013 14:05:38 GMT</pubDate><dc:creator>Thomas Holste</dc:creator></item><item><title>RE: Accessing a form from 2 different forms with 2 different child-dialogs</title><link>http://forum.strataframe.net/FindPost31696.aspx</link><description>No, it doesn't look like your approach is wrong. &amp;nbsp;We have child forms that are called from multiple places. &amp;nbsp;Can you post more information on the exception you are receiving. &amp;nbsp;I would guess that it is an IndexOutOfRangeException. &amp;nbsp;The type of exception, and the stack trace would be great.</description><pubDate>Wed, 09 Jan 2013 13:39:06 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>