Click here to Skip to main content
15,920,217 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I can't manage to color the cell in the column header of a datagridview:
I understand from the documentation that something like this should work,
but it doesn't work...

C#
DataGridView1.TopLeftHeaderCell.Style.BackColor = System.Drawing.Color.Blue;



Thanks,
Posted
Updated 26-Dec-11 23:35pm
v3
Comments
Mohibur Rashid 27-Dec-11 4:48am    
Why have you tagged C :O
alizadeh91 27-Dec-11 5:36am    
Sry.. that was a mistake..

 
Share this answer
 
Your code is fine but I think there may be issue in other code-block(You didn't include the full code), check these

Column Fill Mode in the Windows Forms DataGridView Control[^]
How to: Set Font and Color Styles in the Windows Forms DataGridView Control[^]
 
Share this answer
 
Actually my code had a problem ...sorry it works:
DataGridView1.TopLeftHeaderCell.Style.BackColor = System.Drawing.Color.Blue;
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900