user6167266 user6167266 - 1 year ago 171 Question

Change colour of DataGridViewCheckBoxColumn?

I have the following code to add a checkbox column to my grid..

Dim excludeColumn As New DataGridViewCheckBoxColumn
With excludeColumn
.Name = "(excl)"
.DataPropertyName = "exclude"
.Width = 300
.Visible = True
.DefaultCellStyle.ForeColor = Color.LightBlue
End With

Why doesn't the colour of the
property change as required above?

Answer Source

You want the .BackColor property. .ForeColor changes the text color which isn't present on a checkbox column.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download