I have made a Windows Form application with a textbox. I will force users to use the barcode scanner, so the keyboard input should be disabled. The KeyPressed event does not wor
You can find the way to check with keysUp and Keysdown event.
Check here for detailed answer.
Check here for answer
Check here for github code
Based on your description, I assume that your barcode scanner is an HID barcode scanner. If so, there is no easy answer here because the barcode scanner functions exactly like a keyboard. Disabling keyboard input will disable the barcode scanner.
I have done this before, and there are a few solutions I know of:
However, one caveat: You probably don't want to disable the text box at all. What if the barcode is damaged and the scanner cannot read it? You always want the user to be able to manually enter the barcode. Next time you go through the cash register at a store, notice that there is always a way to manually enter the barcode.