
我尝试了这段代码,但根本没有为上述场景工作
private void key_up(object sender,EventArgs e)
{
if (dataGridView1.CurrentRow == null) return;
if (dataGridView1.CurrentRow.Index - 1 >= 0)
{
dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.CurrentRow.Index - 1].Cells[0];
dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Selected = true;
}
}
Run Code Online (Sandbox Code Playgroud) c# ×1