Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging keyboard events like 'Ctrl+Up Arrow'

I want to debug a part of a program that is intended to respond to keyboard input such as Ctrl+.

So, I put a breakpoint in the code in the area interest. However, once I press the Ctrl key the program jumps to that breakpoint. This happens before I have pressed an arrow key, so I'm finding this situation difficult to debug.

So, how can I debug a multi-key input event such as Ctrl+?

like image 924
Bohn Avatar asked Dec 06 '22 23:12

Bohn


1 Answers

If you are using Visual Studio to debug your code, you can debug this situation by adding a condition to your breakpoint.

To do so, right-click the break point icon to the left of your code statement and click Condition... An example of a condition that would apply to your situation is:

e.Control && e.KeyCode == Keys.Up

Now you can debug multi-key input events such as Ctrl+ without the need to change any of your code.

like image 168
Martin Avatar answered Dec 31 '22 18:12

Martin