Not a bad idea, but I used a slightly different approach, you create an
input loop, then test each character for the carrage return, and continue to
loop the input till you get the carrage return. Almost every barcode scanner
adds it... That way you always get a good read, no matter how long the
string you are getting from the barcode.
Mark
"Randy Day" wrote in message
> W. Boon wrote:
>> Does anyone know how to write a procedure in VB6 for a barcodescanner. I
>> cannot automize the reading to processing. PE I can make de reading of
>> the barcode, but i cannot make a search in a database without a button or
>> something like that to continue the process. I want to read the barcode
>> and directly start the search in the database.
>
> Put a timer on your form, with an interval (50-100ms)
> that is long enough to allow the scanner to finish
> sending the barcode. Set the timer.enabled=false.
>
> When your program detects the first char of a
> barcode, enable the timer. Put your database search
> in the timer event, like this
>
> Private Sub Timer1()
>
> Timer1.enabled=false
>
> 'IMPORTANT! Disable timer *before* doing search!!
>
> CallYourDatabaseSearchProcedure()
>
> End Sub
>
> This way, the database search is delayed until
> the barcode is complete, and since the timer
> disables itself, it won't fire again until another
> barcode is entered.
>
> Play with the timer interval to find one that gives
> a quick response while allowing the barcode to
> complete.
>
>
> HTH
>> Stay informed about: input barcodescanner