C# datagridview 取某行中的某值,

方法1:

string aa;

aa=dataGridView1.CurrentRow.Cells["XX"].Value.ToString();

//XX:某一列的字段名,即SQL语句中的取得内容。

方法2:

String str = this.DataGridView.SelectedCells[0].Value.ToString();

方法1经测试过没有问题,方法2没有测试过。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-14
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2022-12-23
  • 2021-09-20
相关资源
相似解决方案