How can I filter the text box of Microsoft.NET 2.0 to use only USB characters?

I am using a Microsoft.NET text box in Windows Forms 2.0 using C # for data from a USB barcode scanner. The user does not want the text field to accept keyboard inputs. How can I apply a filter so that only USB inputs are accepted and the keyboard is turned off during this session?

Thanks.

Comment added an hour after: I got something in this and this that I need to learn.

For those of you who want to know why this redundancy, the user also wants to configure the keyboard as active / inactive.

0
source share
1 answer

You can not. A barcode scanner is a keyboard (sorts). It enters text characters just like a keyboard.

I believe that one option would be to disable the physical keyboard. And by not allowing this, you can "try" to block input based on the hardware serial number. But the problem is that a) that it does not scale, and b) if your scanner ever dies, you need a monkey with your software.

Also remember, barcodes are simply linear representations of human-readable characters. This way, you can enter tiny numbers under the barcode manually if your scanner cannot read them.

I would step back and tell the boss that a bad idea (depending on the context of the request, of course).

+5
source

Source: https://habr.com/ru/post/1341363/


All Articles