C# ComboBox.SelectedIndex = -1; not showing blank, its showing first record

243 views Asked by At

I have ComboBox.SelectedIndex = -1; set for a combobox in a windows form.

However when I open the form it loads in the first value from the DB rather than blank.

I have used ComboBox.SelectedIndex = -1; on other forms and it works correctly in showing a blank.

It sits inside:

private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
{
    employeeIDComboBox.SelectedIndex = -1;
}

Which is showing:

enter image description here

Working on another form with the same code:

private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
{
    regComboBox.SelectedIndex = -1;
}

Which works showing:

enter image description here

0

There are 0 answers