views:

277

answers:

2

I have a combobox where the SelectedValue on the combo is bound to a property on a business object.

Everything works fine, but the property that's bound to the SelectedValue on the combo only gets updated when the focus leaves the control. I understand that the property doesn't get updated until the control is validated (loses focus), but I need it to update the datasource as soon as the dropdown is closed.

I know I could probably leave focus from the control on the DropDownClosed event but I'd prefer something a little less kludgy.

What's the best way to immediately update my datasource when the dropdown is closed?

+1  A: 

Set the DataSourceUpdateMode to OnPropertyChanged. Here is similar problem:

[http://social.msdn.microsoft.com/Forums/en/winformsdatacontrols/thread/bc39342b-d9b5-4ad0-bd35-073869ccf8be][1]

lya
A: 

The way I'd do it is to set (in the events) the OnUpdate of the combo box and put in the VB.net

Me.<business object>.Requery
Harold