how to get the background color of the rows?

Posted by Vforvijay under VB.NET on 3/9/2011 | Points: 10 | Views : 3378 | Status : [Member] | Replies : 5
hi..
how to get the background color code of the row from the datagrid view?




Responses

Posted by: Prabhakar on: 3/9/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi vijay


just right click on datagridview then click DataGridViewCellStyle property and set back color
DataGridViewCellStyle { BackColor=Color [ActiveCaption]}

Best Regard's
Prabhakar

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 3/9/2011 [Member] Starter | Points: 25

Up
0
Down
hi prabhakr..

i need to get the backgroundcolor(already color in the rows) of the rows by using code.....

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhuk on: 3/9/2011 [Member] Starter | Points: 25

Up
0
Down
Check this dataGridView1.RowsDefaultCellStyle.BackColor

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhu.b.rokkam on: 3/9/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
if (GridView1.RowStyle.BackColor == Color.Red)

GridView1.RowStyle.BackColor = Color.DeepPink;
else
GridView1.RowStyle.BackColor = Color.Red;


GridView1.RowStyle.BackColor - sets or gets the row background color.

Thanks and Regards
Madhu

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 3/10/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Check this link

http://www.codeproject.com/KB/grid/GridViewRowColor.aspx

Thanks
Karthik
www.f5Debug.net

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response