programmernovice
programmernovice

Reputation: 3941

How to get the value of the first column of current row of Winform DataGridView?

This is something simple yet I cannot find any answer searching google !

I tried this in C#

MessageBox.Show(this.DataGridView1.CurrentRow.Cells[0].ToString());

This returns me row and column index not the value of the cell.

How to get the value instead ?

Thanks.

Upvotes: 2

Views: 3277

Answers (1)

Eric J.
Eric J.

Reputation: 150108

You need to reference the value:

MessageBox.Show(this.DataGridView1.CurrentRow.Cells[0].Value.ToString());

Upvotes: 5

Related Questions