Consultor Eletrônico



Kbase P184910: Value in TextBox control is not assigned to ProBindingSource
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/7/2011
Status: Unverified

SYMPTOM(s):

Value in TextBox control is not assigned to ProBindingSource

When user edits a TextBox, and then clicks a "Save" button on the form before leaving the TextBox, the old value is assigned to the binding source rather than the edited value.

FACT(s) (Environment):

Application contains a "Save" button control to save all screen values to the data source through the ProBindingSource.
When user tabs out of TextBox before clicking the "Save" button, the edited value is assigned to the binding source.
The Click event handler of the "Save" button assigns the values in the form's controls using the BindingSource:Assign method.
Windows
OpenEdge 10.2x

CAUSE:

The value in the TextBox has not been verified, or "validated", when focus is shifted to the "Save" button with a mouse click. When the BindingSource:Assign method executes, the value the TextBox held the last time it was validated is the value that is saved to the ProBindingSource. On the other hand, if the user tabs out of the TextBox its value is validated at that time, so the newly added value is saved to the ProBindingSource.

FIX:

In the event handler for the "Save" button, call the form's Validate method to verifiy the value of whichever control is losing focus when focus shifts to the "Save" button. For example:
THIS-OBJECT:Validate().