你是想获取总行数?还是选中行和列的索引?获取总行数:dataGridView1.Rows.Count;获取当前选中行索引:int i = this.dataGridView1.CurrentRow.Index;获取当前选中列索引:int j = this.dataGridView1.CurrentCell.ColumnIndex;