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.

Recommended Answers

All 2 Replies

Member Avatar for Huntondoom
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();[/
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.