I've got a combobox where the SelectedValue property is bound to a class
property by a code like this:
MyComboBox.DataBindings.Add("SelectedValue", MyClass , "MyID");
My problem is that the MyClass.MyID property gets updated when the focus
leaves the combobox - not when you actually select a new item from the drdop
down list.
I would have expected this code to solve the problem, but it didn't:
MyComboBox.DataBindings.DefaultDataSourceUpdateMod e =
DataSourceUpdateMode.OnPropertyChanged;
I would do a work around and do a method in my class called UpdateMyID(long
MyIDValue) and call it from the MyComboBox_SelectedItemChanged event (which
is fired correctly), but the drop down list in the combo is data bound with
a ValueMember which is the ID in long format and a DisplayMember which is
the Value in string format, and I can't figure out how to get the
ValueMember from the SelectedItem and use it in calling my method. There is
apparently no SelectedItem.ValueMember property, and as far as I can see in
the intellisense no way of getting the ValueMember property
The best would be if I could programmatically for the databinding to update,
but there is no
MyComboBox.DataBindings.Refresh
method either.
Any suggestions as to how I can solve it?
Cheers,
Johnny J.