5条回答 默认 最新
关注private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Down) { this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index + 1 > this.dataGridView1.Rows.Count ? this.dataGridView1.Rows.Count - 1 : this.dataGridView1.CurrentRow.Index + 1].Selected = true; } if (e.KeyData == Keys.Up) { this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index - 1 < 0 ? 0 : this.dataGridView1.CurrentRow.Index - 1].Selected = true; } }本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
