//dataGridView1.Rows[0].Selected = false; //放在Form1这里不起效果 可放在下面的Form1_Load中 this.button1.Focus(); } private void Form1_Load(object sender, EventArgs e) { dataGridView1.Rows[0].Selected = false; //this.dataGridView1.TabStop = false; //dataGridView1.Rows[0].Selected = false; //this.dataGridView1.CurrentCell = null; //dataGridView1.ClearSelection(); }
搜到重点 ,放上来
MessageBox.Show(dgvPo.Rows[0].Selected.ToString());
MessageBox.Show(dgvPo.CurrentRow.Index.ToString());
弹出来的是Flase,0
说明它没被选中,但是它是当前行
MessageBox.Show(dgvPo.Rows[0].Selected.ToString());
MessageBox.Show(dgvPo.CurrentRow.Index.ToString());
弹出来的是Flase,0
说明它没被选中,但是它是当前行
Selected = true只是让这个单元格被选中,不代表当前单元格就变成它了