المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Is there a better way for updating bound controls when updating the data source manually?



C# Programming
11-06-2009, 08:51 AM
Hi

I have a form that has text boxes and combos bound to fields in an object. When the user is using the form they have the option to apply some default values to some of the fields. I was hoping that I would just have to either update the control with the value or just update the field in the object. When I update the field in the object, the form will not ******* with the new values until another field on the form is changed. If I update the control, the field in the object does not update.

My way around this was to update both like this

case "LOGCERT_LEVEL_":
logginCertCombo.SelectedValue = newValue;
staff.LogCert = newValue;
break;

To me that is a bit ugly http://www.barakasoft.com/script/Forums/Images/smiley_dead.gif

Is there a way to do this automatically? My controls are bound like this
logginCertCombo.DataBindings.Add("SelectedValue", staff, "LogCert");
I've tried google and today it is not being my friend.

Many Thanks

The FoZ