﻿<?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?)  » Initializing bound control after Add()</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Thu, 10 Sep 2026 15:18:14 GMT</lastBuildDate><ttl>20</ttl><item><title>Initializing bound control after Add()</title><link>http://forum.strataframe.net/FindPost28572.aspx</link><description>Hello,&lt;br/&gt;&lt;br/&gt;&lt;div&gt;I'm trying to initialize some of the properties of a new BO that's being added through a call to Add of a form.&lt;br/&gt;&lt;br/&gt;&lt;div&gt;I have a form that I I show like so:&lt;br/&gt;&lt;br/&gt;&lt;div&gt;&lt;span&gt;[code]&lt;/span&gt;&lt;br/&gt;&lt;div&gt;&lt;div&gt;Using frmNewEv As New frmNewEvent&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;frmNewEv.Add()&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;frmNewEv.BoEventLog1.username = "User1"&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;frmNewEv.ShowDialog()&lt;div&gt;End Using&lt;div&gt;[/code]&lt;br/&gt;&lt;br/&gt;&lt;div&gt;In the form I have some textBoxes that are bound to the BOEventLog1 (through BusinessBindingSource), including the txtUsername bound to the&amp;nbsp;BoEventLog1.username. I'd expect the above code to initialize the txtUsername to "User1" but it's not the case - the textbox is empty.&lt;br/&gt;&lt;br/&gt;&lt;div&gt;What's even stranger is that if I set txtUsername.editvalue to "User1" in Load event of&amp;nbsp;frmNewEvent, I see it, but as soon I enter value in a topmost textbox and tab to the next textbox (txtUsername is the fourth field), the value of the txtUsername gets cleared. It only stays there if I put the cursor in the txtUsername first and then go back to the first field.&lt;br/&gt;&lt;br/&gt;&lt;div&gt;How should I initialize the txtUsername?&lt;br/&gt;&lt;br/&gt;&lt;div&gt;&amp;nbsp;</description><pubDate>Fri, 15 Oct 2010 09:52:52 GMT</pubDate><dc:creator>Lukasz Kustusz</dc:creator></item><item><title>RE: Initializing bound control after Add()</title><link>http://forum.strataframe.net/FindPost28708.aspx</link><description>You are welcome, Lukasz. :cool:</description><pubDate>Fri, 15 Oct 2010 09:52:52 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: Initializing bound control after Add()</title><link>http://forum.strataframe.net/FindPost28588.aspx</link><description>Igor,&lt;br/&gt;&lt;br/&gt;&lt;div&gt;Thank you for your reply. It did the trick.</description><pubDate>Tue, 05 Oct 2010 11:11:31 GMT</pubDate><dc:creator>Lukasz Kustusz</dc:creator></item><item><title>RE: Initializing bound control after Add()</title><link>http://forum.strataframe.net/FindPost28574.aspx</link><description>Hi Lukasz.&lt;br/&gt;&lt;br/&gt;Have a look at the help file under Application Framework / Business Layer / Common Business Object Tasks / Business Object Events / SetDefaultValues.</description><pubDate>Mon, 04 Oct 2010 17:06:31 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item></channel></rss>