I have 2 databound comboboxes on a form.
When an item is selected from the first combobox, a filter is applied to the bindingsource of the second combobox to only show relevant options.
When there is only one option in the second combo box, I want that to be the one that is selected.
I am currently using ComboBox2.Selectedindex=0 to achieve this, and the correct value is shown in the ComboBox2.
However when I try to save the record, I get an error saying that column xxx does not allow nulls... i.e. the second combobox is not databinding the value that it is showing.
If, however, I physically click on the second combobox and select the value (the only one), then it has no problem databinding that value.
All I can assume is that there is another method to select the first item in the combobox in a way that the databinding is happy with.
Can anybody help me?
When an item is selected from the first combobox, a filter is applied to the bindingsource of the second combobox to only show relevant options.
When there is only one option in the second combo box, I want that to be the one that is selected.
I am currently using ComboBox2.Selectedindex=0 to achieve this, and the correct value is shown in the ComboBox2.
However when I try to save the record, I get an error saying that column xxx does not allow nulls... i.e. the second combobox is not databinding the value that it is showing.
If, however, I physically click on the second combobox and select the value (the only one), then it has no problem databinding that value.
All I can assume is that there is another method to select the first item in the combobox in a way that the databinding is happy with.
Can anybody help me?