Hi all,

I am a beginner in C# and am exploring dataGridView currently ,am stuck at a point would be amazing if i could get a professional insight on the below problem.

I want to capture the data from the cell of the dataGridView.Basically i want the value of the particular cell selected .It would be much appreciated if the funda behing it could also be explained.

Member Avatar


int rowindex, cellindex
rowindex = 0 //rowindex is the vertical value
cellindex = 0 //cellindex is the horizontal value
string CellContent = datagridview.rows(rowindex).cell(cellindex).value.tostring();

when using an event such as a cell content changed, will give the rowindex and cellindex these can then be used as shown above

usually would look like:

string CellContent = datagridview.rows(e.rowindex).cell(e.cellindex).value.tostring();[/