Frage

I have a Windows Forms application containing a textbox used to provide input to the application from a handheld barcode scanner. The barcodes we are using may contain special control characters like ESC whose default behavior is to clear out the input line. In order to be able to read such barcode string into the application I use the following method which is hooked into the textbox on key up event:

private void OnKeyUp(object sender, KeyEventArgs e){barcodestr += (char)e.KeyValue;}

The problem is that the line feed characters are being ignored by OnKeyUp method and I am not sure how I could capture those.

Please note that setting the Multiline/AcceptsReturn textbox attributes in any combination of true and false does not seem to make any difference.

War es hilfreich?

Lösung

In the end it worked after switching to using the KeyPress event instead of the KeyUp.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top