Thursday, November 16, 2006

binding Source n Combo box initialization problem



I was trying to bind a combo box to a list of items . Now each item is a domain object .

myBindingSource.DataSource = my list of domain objects

i create a binding between the SelectedItem property of the combo box and the property Value of my domain object in the binding source .

now initially when the value of my domain object is null , i want an empty row to appear in the combo box , which works fine . Now as i choose different domain object values in the combo box , the value of the domain object is not refreshed .

I was using myComboBox_SelectedIndexChanged event to notify of the change in domain object value , but it was not helping the refreshing of other entities that depended on the values of the domain object .

So now instead of the SelectedIndexChanged Event now i use the
myBindingSource_CurrentChanged event and it works like a charm