I have ComboBox databound to BindingSource. It works well except one case. When I erase text in ComboBox it happens that ComboBox.SelectedIndex=-1 and ComboBox.SelectedValue=null, which is correct. Problem is that DataSource property bound to ComboBox.SelectedValue is not updated with the null value but it keeps the previous selection.
Here are fragments of code that might be important.
ComboBox.DropDownStyle=DropDown; I want ComboBox to be editable
BindingSource.DataSource=oneRowDataTable; oneRowDataTable means that this table has always 1 row of data
ComboBox.DataBindings.Add("SelectedValue", BindingSource, "InvoiceID"); ComboBox.SelectedValue is mapped to BindingSource, it works well when I choose from existing values in ComboBox
This is link with similar problem but it did not help me.
Thank you for any advice.
I asked this question on Micorosft forum as well. I have got this answer MSND forum. It is practically the same solution as I mentioned in my comment. I am going to live with this solution and I will see how it works.