how to insert value into DataGridView Cell?

c#, datagridview

Solution

You can access any DGV cell as follows :

dataGridView1.Rows[rowIndex].Cells[columnIndex].Value = value;

But usually it's better to use databinding : you bind the DGV to a data source (`DataTable`, collection...) through the `DataSource` property, and only work on the data source itself. The `DataGridView` will automatically reflect the changes, and changes made on the `DataGridView` will be reflected on the data source

Problem

I have `DataGridView` (that hold any `DataBase`) I want to insert any value into any Cell (and that this value will save on DataBase) How to do it (in C#) Thank's in advance

Original source