Print Page | Close Window

Can't get UI to update until I tab off LookUpEdit control

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=254
Printed Date: 12-Jun-2026 at 4:19am


Topic: Can't get UI to update until I tab off LookUpEdit control
Posted By: Customer
Subject: Can't get UI to update until I tab off LookUpEdit control
Date Posted: 16-Jul-2007 at 10:09am

A little info for you; when changing the OriginCustomer or DestinCustomer in the selection list (LookUpEdit Controls) the Binding source for those controls does not fire a change event.

 

I am using DevExpress 7.1.1.0 and DevForce Professional 3.5.0.1.




Replies:
Posted By: IdeaBlade
Date Posted: 16-Jul-2007 at 10:10am
The change event is firing.  It just doesn’t fire immediately after you have made the new selection.  It fires when the control property is validates (which would happen when you tabbed to a new control).  To make your application behave the way you want, you must set the DataSourceUpdateMode to OnPropertyChanged.  I got your application to behave the way that you want by adding these four lines:

 

      unitCBM.Descriptors.Get(originCustomerLookUpEdit).DataSourceUpdateMode = _

          DataSourceUpdateMode.OnPropertyChanged

        unitCBM.Descriptors.Get(originAddressLookUpEdit).DataSourceUpdateMode = _

          DataSourceUpdateMode.OnPropertyChanged

        unitCBM.Descriptors.Get(destinCustomerLookUpEdit).DataSourceUpdateMode = _

          DataSourceUpdateMode.OnPropertyChanged

        unitCBM.Descriptors.Get(destinCustomerLookUpEdit).DataSourceUpdateMode = _

          DataSourceUpdateMode.OnPropertyChanged

 

Here is the enumeration for DataSourceUpdateMode.

 

 

Member name

Description

http://msdn2.microsoft.com/en-us/library/ms159281.CFW%28en-us,VS.85%29.gif">

Never

Data source is never updated and values entered into the control are not parsed, validated or re-formatted. 

http://msdn2.microsoft.com/en-us/library/ms159281.CFW%28en-us,VS.85%29.gif">

OnPropertyChanged

Data source is updated whenever the value of the control property changes.  

http://msdn2.microsoft.com/en-us/library/ms159281.CFW%28en-us,VS.85%29.gif">

OnValidation

Data source is updated when the control property is validated,  

After validation, the value in the control property will also be re-formatted

 

I’ve attached the completed solution.




Posted By: Customer
Date Posted: 16-Jul-2007 at 10:12am
I have added the lines of code that you sent to the Form_Load event after setting the datasource; and still have the same results. If I set a break point on the:

 

    Private Sub originCustomerBS_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles originCustomerBS.CurrentChanged

        Me.Validate()

        UpdateOriginAddresses()

    End Sub

 

And I change the originCustomerLookupEdit selection, it will never break on the Binding Source change events. I have also tried the other events:

ListChanged,

CurrentItemChanged,

PositionChanged… etc.

 

All with the same results, none of them break when I change the selection in the control, or when I tabbed to a new control. However they all do break when the form is loading. After the form is loaded, they no longer respond.



Posted By: IdeaBlade
Date Posted: 16-Jul-2007 at 10:13am

I had a hard time finding something that works, but I eventually found:

Private Sub originCustomerLookUpEdit_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles originCustomerLookUpEdit.TextChanged

        Me.Validate()

    End Sub

 

Note that this is what you can use if you are using DataSourceUpdateMode.OnPropertyChanged

If you are updating on DataSourceUpdateMode.OnValidation, you can also use the following event: 

  Private Sub originCustomerLookUpEdit_Validated(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles originCustomerLookUpEdit.Validated

        Me.Validate()

    End Sub

 




Print Page | Close Window