StrataFrame Forum

Initializing bound control after Add()

http://forum.strataframe.net/Topic28572.aspx

By Lukasz Kustusz - 10/4/2010

Hello,

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.

I have a form that I I show like so:


Using frmNewEv As New frmNewEvent
      frmNewEv.Add()
      frmNewEv.BoEventLog1.username = "User1"
      frmNewEv.ShowDialog()
End Using


In the form I have some textBoxes that are bound to the BOEventLog1 (through BusinessBindingSource), including the txtUsername bound to the BoEventLog1.username. I'd expect the above code to initialize the txtUsername to "User1" but it's not the case - the textbox is empty.

What's even stranger is that if I set txtUsername.editvalue to "User1" in Load event of 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.

How should I initialize the txtUsername?

 
By Ivan George Borges - 10/4/2010

Hi Lukasz.

Have a look at the help file under Application Framework / Business Layer / Common Business Object Tasks / Business Object Events / SetDefaultValues.
By Lukasz Kustusz - 10/5/2010

Igor,

Thank you for your reply. It did the trick.
By Ivan George Borges - 10/15/2010

You are welcome, Lukasz. Cool