ubstitute of keys press event
-
I am using vb.net 2008 I want to take Input in a text box from other defice like Barcode Scan or Card Swipe. But I need to Stop Manual input from keyboard on That TextBox. I Test in my code That in Both Cases "KeyPress Event" Called. How Can I do that? Textbox taken Input from Other Device and Not From Keyboard.
Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)
-
I am using vb.net 2008 I want to take Input in a text box from other defice like Barcode Scan or Card Swipe. But I need to Stop Manual input from keyboard on That TextBox. I Test in my code That in Both Cases "KeyPress Event" Called. How Can I do that? Textbox taken Input from Other Device and Not From Keyboard.
Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)
-
I am using vb.net 2008 I want to take Input in a text box from other defice like Barcode Scan or Card Swipe. But I need to Stop Manual input from keyboard on That TextBox. I Test in my code That in Both Cases "KeyPress Event" Called. How Can I do that? Textbox taken Input from Other Device and Not From Keyboard.
Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)
Since most of those devices are keyboard emulators anyway (normally refered to as "keyboard wedge") you cannot disable the keyboard. You would find it extremely difficult to tell the difference between a normal keyboard key and one coming from the scanner. You normally would not even bother with the textbox but enable the forms KeyPreview property, then handle it's KeyDown event, looking for the prefix string that is prepended to the code coming from the scanner. You ARE using pre- and post-fix codes coming from the scanner, right? If not, you'll find it impossible to tell the difference between what it typed and what is scanned. All of the characters you see after the prefix string will be whats scanned, until you see the postfix characters. When you see the prefix code, you do NOT pass the keystrokes up the chain to the textbox.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009...