DataGridViewComboBoxColumn Drop Down Menu Appears All Black

This annoying bug was haunting me for quite a while. Luckily Nick Olsen figured it out

Code to fix

01 private void dataGridViewGLEntries_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
02 {
03     ComboBox cmbBx = e.Control as ComboBox;
05     if (cmbBx != null)
06     {
07         cmbBx.SelectedIndexChanged -= ComboBoxCell_SelectedIndexChanged;
08         cmbBx.SelectedIndexChanged += ComboBoxCell_SelectedIndexChanged;
10         // Fix the black background on the drop down menu
11         e.CellStyle.BackColor = this.dataGridViewGLEntries.DefaultCellStyle.BackColor;
12     }
13 }

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: