USB Barcode scanner

pierrewhy

Member
Joined
Oct 4, 2005
Messages
14
Programming Experience
5-10
[Resolved] USB Barcode scanner

I'm using an USB scanner to read a barcode into a textbox.
I want to read the database after the scan is complete without having to use a button.
I've been using a TextChanged event on my form but it get going before the scanner has time to put the whole number into the textbox.
How can I slow down the process until the whole number is on my form.
thank you,
Roger
 
Last edited by a moderator:
How is the barcode being entered into the TextBox? If you are putting it in one character at a time then that's not going to work. Try putting each character into a String variable first and then just setting the Text property once when the entire barcode has been read.
 
I must be mising something.
The scanner read the code and write it onto the textbox.
Is there something that would let the scanner work like a (Private Sub Button_Click).
I want to be able to keep the value scanned into a variable and play with it afterword.
Thank you,
Roger
 
I am not sure about USB scanner, but for AT5pin scanner, it will put a carriage return after the scanned characters. If it does, you can detect the carriage return, it is like pressing the <Enter> key
 
It doesn't look like I have a carriage return after the scan.
The textbox get filled with the numbers but nothing else happen.
Any other hint about a way to have my program retrieve the data associated with the scanned number, without using the enter button.
thank you,
Roger
 
Barcode Variable Length

IF THE VARIABLE IS OF FIXED LENGHT, YOU COULD USE THE TEXT CHANGED EVENT WITH;
IF txtbarcode.textlength = # THEN

HOPE THAT HELPS
 
Barcode scanner

The scream woke me up.
Otherwise this is getting to be a lot of coding for a simple function.
Since the barcode will never be the same length I can't check for the textbox length.
All I need is to refresh the whole form as soon as a new scan is done.
Right now it write in the new scan beside the whole one in the text box.
Everything else work fine.
Thank's everyone for your help.
Roger:eek:
 
Are you able to use jmcilhinney's suggestion? That way, your TextChanged event would happen after the entire string has been entered.
 
mjb3030 said:
Are you able to use jmcilhinney's suggestion? That way, your TextChanged event would happen after the entire string has been entered.
Exactly. You say you want the value in a variable afterwards anyway, so why not put it in one in the first place. If your TextChanged event handler is being called more than once then the Text must be being changed more than once. If you make sure it only changes once then you only get one event. This seems pretty obvious to me.
 
Back
Top