We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How can I change a row color by a data value

I want to change a row color to red when a data value == 1. How can I do that in datagrid in C# winForm?

3 Replies

SI SiD October 6, 2005 09:09 AM

Override the paint method. Object o = this.DataGridTableStyle.DataGrid[rowNum,]; int chk = Convert.ToInt32(o); if(chk == 1) { foreBrush = new SolidBrush(Color.Blue); }


SI SiD October 6, 2005 09:09 AM

Override the paint method. Object o = this.DataGridTableStyle.DataGrid[rowNum,]; int chk = Convert.ToInt32(o); if(chk == 1) { foreBrush = new SolidBrush(Color.Blue); }


SI SiD October 6, 2005 09:09 AM

Override the paint method. Object o = this.DataGridTableStyle.DataGrid[rowNum,]; int chk = Convert.ToInt32(o); if(chk == 1) { foreBrush = new SolidBrush(Color.Blue); } >I want to change a row color to red when a data value == 1. >How can I do that in datagrid in C# winForm?

Loader.
Live Chat Icon For mobile
Up arrow icon