Hi all
I tried what you said about simulating the key board input using VB6.0 VF6.0 VF7.0Beta and no way in hill it works. Not a surprise for me caz if it worked I would feel so dumm when I have to send my serial communication class to the trash can. Well my friend Venado here how it works...
Assuming that the bar code scanner you wanna use is connecting to one of the serial ports ( This is important ) and this the case 99%. Make sure that you understand that the according to the bar code you want to read, your return value either numbers only (Code 128 or I2o5) or mix of numbers and characters (Code 39). So your job is to get this return value from the scanner as string, save it in variable, then do what ever you want with it just like any string variable. Enough introduction let's go to work
Select Tools->Options->Controls and set reference to Microsoft Communication Control Version 6.0. This ActiveX control will handle all the communication between your App and the serial ports. put it in your form from the ActiveX tool bar.
In the Init event of this control insert this command
*--
The most important property of this control is InputLen
which is the number of characters in your bar code. you can set it in the design time or programmatically in the run time but make sure you set it.
*--
set this property to the port you connected you barcode scanner to. 1 or 2 for example.
*--
Code:
Name = BarCodeScaner &&-- for example
*--
Add a text box to your from name txtBarCode.
Now put a command butoon in your from and in the click event of it insert this command
Code:
lcBarCode=thisform.barcodescaner.input()
txtBarCode.Value= lcBarCode
Now, run your from,
scan your bar code first, click the command button, your bar code is there in the text box.
I will leave the rest to your imagination, like replace the command button with timer to pool the barcode scanner for input every x sec, or trim the return string if it has any special chars.
Hope I answered your Q.
Have fun
Walid