How do I flush the keyboard buffer in C# using Windows Forms?
I have a barcode scanner which acts like a keyboard. If a really long barcode is scanned and the cancel
Set KeyPreview on the Form to true, then catch the KeyPress event and set e.Handled to true if cancel was clicked.
KeyPreview
true
KeyPress
e.Handled
EDIT: Catch the Form's KeyPress event