Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Monday, 6 April 2015

DataGridView changing cell background color

To change the cell background color in a Datagridview in a windows application we want to use the following
we have a datagridview with an Id of "dgvStatus".
First bind the datagridview while binding use the following code to change the cell backgroundcolor

//background color of cells

dgvStatus.DefaultCellStyle.BackColor = Color.FromArgb(255, 192, 128);

//dgvStatus.DefaultCellStyle.BackColor = Color.FromArgb(value of Red, value of Green, value of Blue);





Thanks Stackoverflow

Friday, 20 March 2015

How to hide the header and first empty column in datagridview using c#

Here we are going to see how to hide the header of a "DATAGRIDVIEW" in a form. First when we bind a datagridivew its like this, with a header with the database column name.