---
title: "How to Create Columns in DataGridView Windows Application in c#"  
description: "How to Create Columns in DataGridView Windows Application in c#"  
author: "Anonymous User"  
published: 2015-12-13  
updated: 2015-12-13  
canonical: https://www.mindstick.com/forum/33721/how-to-create-columns-in-datagridview-windows-application-in-c-sharp  
category: "c#"  
tags: ["c#", "windows controls", "datagridview"]  
reading_time: 1 minute  

---

# How to Create Columns in DataGridView Windows Application in c#

I want to Create Columns in [DataGridView](https://www.mindstick.com/articles/607/working-with-datagridview-in-vc-sharp) [Windows](https://www.mindstick.com/articles/311752/how-to-install-and-use-the-google-wifi-software-on-a-windows-or-mac-computer) [Application in c#](https://www.mindstick.com/interview/34012/how-do-you-create-a-windows-forms-application-in-c-sharp). please Help me.

## Replies

### Reply by Anonymous User

The DataGridView control makes it easy to define the basic appearance of cells and the display formatting of cell values. The cell is the fundamental unit of interaction for the DataGridView. All cells derive from the DataGridViewCell base class. Each cell within the DataGridView control can have its own style, such as text format, background color, foreground color, and font. Typically, however, multiple cells will share particular style characteristics. The data type for the cell's Value property by default is of type Object.

```
using System;using System.Collections.Generic;using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;using System.Drawing.Imaging;using System.Data.SqlClient;using System.Data;namespace WindowsForums{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        private void CreateColumn()        {                        dataGridView1.Columns.Add("id", "ID");            dataGridView1.Columns.Add("productname", "ProductName");            dataGridView1.Columns.Add("quantity", "Quantity");            dataGridView1.Columns.Add("rate", "Rate");            dataGridView1.Columns.Add("amount", "Amount");        }        private void Form1_Load(object sender, System.EventArgs e)        {            CreateColumn();        }         private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)         {           int index=e.RowIndex;           decimal quantity=Convert.ToDecimal( dataGridView1.Rows[index].Cells["quantity"].Value);           decimal rate = Convert.ToDecimal(dataGridView1.Rows[index].Cells["rate"].Value);            dataGridView1.Rows[index].Cells["amount"].Value = (quantity * rate);         }                   }}
```

```

```


---

Original Source: https://www.mindstick.com/forum/33721/how-to-create-columns-in-datagridview-windows-application-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
