hi
i have created one UI application using c#. i want to use PageDown Keys for navigate between rows, but when i press PageDown keys datagridview select last row.
How can i do this?
thanks in advance
my code:
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.PageDown)
{
int cRow=dataGridView1.CurrentRow.Index;
cRow += 1;
dataGridView1.CurrentCell = dataGridView1.Rows[cRow].Cells[0];
try using the SelectionChanged event of the datagridview. you can use arrow keys to navigate through the records and this event gets fired automatically.
I assume what you want to do is trap the Page Down key and use it for navigating the datagridview. The problem in your code is that you are not telling the datagridview that you have aleady handle the key press.
Let it know that you have taken care of the key press by setting the Handled property to true.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.