---
title: "How to set datagridview formatting in C#"  
description: "How to set datagridview formatting in C#"  
author: "Jayden Bell"  
published: 2013-06-15  
updated: 2013-06-15  
canonical: https://www.mindstick.com/forum/1157/how-to-set-datagridview-formatting-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to set datagridview formatting in C#

Hi [developers](https://www.mindstick.com/articles/12875/blunders-you-must-avoid-while-hiring-java-developers-to-get-the-best-fulfilling-your-needs),

I want to change my [datagridview](https://www.mindstick.com/articles/607/working-with-datagridview-in-vc-sharp) appearance so please any [body](https://yourviews.mindstick.com/story/2120/rare-species-having-electricity-in-their-body) provide me any [demo](https://www.mindstick.com/forum/157370/how-to-swap-neighbor-characters-in-string-e-g-string-demo-would-be-edom) for datagridview formatting.

## Replies

### Reply by Sumit Kesarwani

Hi Jayden,\
You can use this code:\

```
  private void Form1_Load(object sender, EventArgs e)  {
  dataGridView1.RowsDefaultCellStyle.BackColor = Color.AliceBlue;
  dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Aqua;
  dataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.None;
  dataGridView1.DefaultCellStyle.SelectionBackColor = Color.CadetBlue;
  dataGridView1.DefaultCellStyle.SelectionForeColor = Color.White;
  dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
  }
```

\

## Code description:

1. This is the Form1_Load event.

3. Here set the default rows back color.

4. Here set the alternative row back color.

5. Here set the datagridview cell border none.

6. Here set the datagridview selected row back color.

7. Here set the datagridview selected row forecolor.

8. Here when I click any cell entire row will selected.


---

Original Source: https://www.mindstick.com/forum/1157/how-to-set-datagridview-formatting-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
