0
votes

I have searched a lot on this topic and cant seem to find what I did wrong so apologies if this has already been answered before.

So I have a combo box with a datasource of Account Types So I set the properties to

DataSource = 'dscAccountTypeList'
DisplayMember = Name
ValueMember = Id

Now I bind this combobox to my datatable via code

cmdAccountType.DataBindings.Add("SelectedValue, dtMaster, "AccountTypeId", True, DataSourceUpdateMode.OnPropertyChanged)

My problem is the AccountTypeId on dtMaster does not update even if I changed the selected item on the combobox. The above method works on textboxes which updates the value on the datatable once the text has been changed. Sure I can set value via Code on change of the combobox but I am wondering why it doesn't automatically update like the textboxes. I already tried clicking on other field to fire the change event but it didn't work. I would appreciate it if anyone can point me in the right direction. Thanks!

P.S. the selected item on the combo box changes once the value on the dtMaster changed. It just doesnt work on the opposite.

1

1 Answers

0
votes

Set your DataSource after you set your DisplayMember and ValueMember, not before.

DisplayMember = Name
ValueMember = Id
DataSource = 'dscAccountTypeList'