المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Cange datagridview cel backcolor if cel has value



C# Programming
01-05-2013, 04:50 AM
Hi,
I use this to change the back color of a cell:
private void dataGridViewData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (!string.IsNullOrEmpty(e.Value.ToString())) { e.CellStyle.BackColor = Color.LightGoldenrodYellow; } }
This works, but also check box cells are changed if they are checked or not.
How can I make an exception for check boxes, or is there an other way to do this?
The datagridview is set to autogenerateColumns = true.

Groover,
0200 A9 23
0202 8D 01 80
0205 00