How to move gridview selected row up/down on KeyUp or Keydown press
<p><img src="http://i.stack.imgur.com/VdC7r.jpg" alt="enter image description here"></p>

<ol>
<li>The user selects one row</li>
<li>there will be up arrow and down arrow.</li>
<li>If the user wants to move up, the user clicks up arrow button</li>
<li>If the user wants to move down, then the user clicks down arrow button</li>
<li>if the row is at the top then up arrow button becomes disabled</li>
<li>if the row is at the bottom then down arrow button becomes disabled</li>
</ol>

<p>i tried this code but not at all working for the above scenario</p>

<p>private void key_up(object sender, EventArgs e)</p>

<pre><code>{
    if (dataGridView1.CurrentRow == null) return;
    if (dataGridView1.CurrentRow.Index - 1 &gt;= 0)
    {

        dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.CurrentRow.Index - 1].Cells[0];
        dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Selected = true;
    }
}
</code></pre>
