有一个dgv,通过dgv的选择列打钩来选择行数据,怎么获取我选择了多少行。
int cellsCount = dataGridView1.SelectedCells.Count; //选中的行数
int r1 = (dataGridView1.SelectedCells[0].RowIndex); //选中的第一行
。。。
int r2 = (dataGridView1.SelectedCells[cellsCount-1].RowIndex);//选中的第cellsCount-1行