如何获取Winform DataGridView当前行的第一列的值?

pro*_*ice 2 datagridview

这很简单但我找不到搜索谷歌的任何答案!

我在C#中试过这个

MessageBox.Show(this.DataGridView1.CurrentRow.Cells[0].ToString());
Run Code Online (Sandbox Code Playgroud)

这会返回行和列索引而不是单元格的值.

如何获得价值呢?

谢谢.

Eri*_* J. 5

您需要引用该值:

MessageBox.Show(this.DataGridView1.CurrentRow.Cells[0].Value.ToString());
Run Code Online (Sandbox Code Playgroud)