C# 获取 DataGridView 指定行数据教程
可以使用以下代码获取指定行的数据:
int rowIndex = 0; // 指定行的索引
DataGridViewRow row = dataGridView1.Rows[rowIndex];
然后可以通过 row.Cells[columnIndex].Value 获取该行指定列的数据,其中 columnIndex 为列的索引。例如:
int columnIndex = 0; // 指定列的索引
string cellValue = row.Cells[columnIndex].Value.ToString();
原文地址: https://www.cveoy.top/t/topic/nYTc 著作权归作者所有。请勿转载和采集!