Initializing bound control after Add()


Author
Message
Lukasz Kustusz
Lukasz Kustusz
StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)
Group: Forum Members
Posts: 29, Visits: 125
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?

 
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Lukasz.

Have a look at the help file under Application Framework / Business Layer / Common Business Object Tasks / Business Object Events / SetDefaultValues.
Lukasz Kustusz
Lukasz Kustusz
StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)
Group: Forum Members
Posts: 29, Visits: 125
Igor,

Thank you for your reply. It did the trick.
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
You are welcome, Lukasz. Cool
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search