79770566

Date: 2025-09-20 22:02:20
Score: 1
Natty:
Report link

Have you tried setting the SelectedValue inside the BindingContextChanged (or DataBindingComplete) event, so that the value is applied after the ComboBox has finished binding? For example:

ComboBox comboBox = new ComboBox();
comboBox.DisplayMember = "varName";
comboBox.ValueMember = "varId";
comboBox.DataSource = drs.CopyToDataTable();

comboBox.BindingContextChanged += (s, e) =>
{
    comboBox.SelectedValue = 12;
};
Reasons:
  • Whitelisted phrase (-1): Have you tried
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: Alparslan ŞEN