﻿<?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?)  » Change the instance of the main BO in a form.</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 23 Jun 2026 09:13:09 GMT</lastBuildDate><ttl>20</ttl><item><title>Change the instance of the main BO in a form.</title><link>http://forum.strataframe.net/FindPost14681.aspx</link><description>Hi all. &lt;/P&gt;&lt;P&gt;What I am trying to do is this: I&amp;nbsp;drop a BO component (let's say CustomerBO) on the form and bind it in different controls. How can change the instance of this BO? I need to implement a method like this:&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New"&gt;private CustomerBO mCustomer;&lt;BR&gt;public void ChangeCustomer(CustomerBO newCustomer)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;mCustomer = newCustomer;&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Where mCustomer is the object which is dropped on the form and bound to all controls, and newCustomer is an object created somewhere outside the form. &lt;/P&gt;&lt;P&gt;After the above assignment, the controls are still bound to the previous instance, and the Save method of the form still saves the original instance. Is there a way of "centrally" changing the instance of the BO (Something like&amp;nbsp;the DataSource property of a BindingSource?)? Do I have to loop all controls and assign it manually?&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;in advance.</description><pubDate>Thu, 06 Mar 2008 09:44:53 GMT</pubDate><dc:creator>George Nentidis</dc:creator></item><item><title>RE: Change the instance of the main BO in a form.</title><link>http://forum.strataframe.net/FindPost14684.aspx</link><description>Create a strataframe user control and drop all of your controls onto the user control.&amp;nbsp; Then drop that user control on your form and use the BOTranslations property.&amp;nbsp; This has that type of logic...there is more to&amp;nbsp; replacing an instance that just changing the property instance, all of the events, field references, etc. have to be reflectively changed in order for this to work.&amp;nbsp; This is not a SF related issue, this is just a .NET related situation where you want to change the instance of an object.&amp;nbsp; You can do this manually through the BusinessObjectTranslator class, but this is a much more complicated approach.&amp;nbsp; This is the class that is used by the User Control and ChildFormDialog when translating those business objects from one instance to another (MicroFour.StrataFrame.UI.WIndows.Forms.BusinessObjectTranslator).</description><pubDate>Thu, 06 Mar 2008 09:44:53 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>