- The user selects one row
- there will be up arrow and down arrow.
- If the user wants to move up, the user clicks up arrow button
- If the user wants to move down, then the user clicks down arrow button
- if the row is at the top then up arrow button becomes disabled
- if the row is at the bottom then down arrow button becomes disabled
i tried this code but not at all working for the above scenario
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;
}
}