Click here to Skip to main content
14,486,704 members
Rate this:
Please Sign up or sign in to vote.
See more:
private void dataGridViewKabelboxen_KeyDown(object sender, KeyEventArgs e)
       {
           if (e.KeyCode == Keys.Down)
           {
               Kabelbox = (Artikel)dataGridView.CurrentRow.DataBoundItem;

           }
           }


If I try to output the current object in Datagridview with keydown, I get the current object but the previous one.


What I have tried:

I have debugging but not success
Posted
Comments
gggustafson 5 days ago
   
Why are you testing for ( e.KeyCode == Keys.Down ) in an event handler that executes on key down?
ZurdoDev 5 days ago
   
It looks like they are testing for the down arrow key when any key is pressed.
gggustafson 5 days ago
   
Good point.
Member 14655281 4 days ago
   
that's right, I have to test after the button is triggered. I think it could work with keypress or keyup

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100