int rows = dataGridView1.CurrentRow.Index ;//获得选种行的索引
string str = dataGridView1.Rows[rows].Cells[0].Value.ToString();//获取第rows行的索引为0列的值 为了取数据库中的ID
MessageBox.Show(str);
DataGridView取出当前行中的值
最新推荐文章于 2021-12-03 18:18:09 发布
int rows = dataGridView1.CurrentRow.Index ;//获得选种行的索引
string str = dataGridView1.Rows[rows].Cells[0].Value.ToString();//获取第rows行的索引为0列的值 为了取数据库中的ID
MessageBox.Show(str);