barcode scanning using VB6

There are really two ways that this can happen.

First, using a scanner with a keyboard interface. You just piggyback the kayboard and the scanner. When anything is scanned it will appear as though it was typed on the keyboard.

Second, using a scanner that has a serial interface. You can us the MSCOMM control in VB6 to monitor the port and you'll receive a string from the scanner.

This may seem like a simplistic view, but it really isn't that difficult.


good luck
 
D

David.Wooden

Hello Teao:

The easiest way (but not the only way) to write serial code in VB6 is to use the MSComm control; an ActiveX control that handles a lot of the serial drudgery for you. You will need the serial protocol for the specific barcode reader that you intend to use. If you can be more specific, we can be more helpful.

Best regards,

David Wooden Senior Software Engineer, Systems Integration Omron Electronics LLC
E-mail: [email protected]
 
Another control that my company uses the the GreenLeaf CommX control (http://www.gleaf.com). This control is similar to the MSComm control except it can actual interrupt your program when something comes into the port. For example, you could have the control interrupt your VB6 app when a CR/LF comes into the port. That is all we used in our barcode reader application. The manual included with the barcode reader should tell you the command protocol used to enable the barcode reader.
 
how can i write into serial port buffer through VB6 using mscomm my code is

Private Sub Command1_Click()
On Error GoTo errHandler

'FOR WRITING
MSComm1.CommPort = 2
MSComm1.Settings = "9600,N,8,1"
MSComm1.PortOpen = True
MSComm1.Output = "Hey its working" 'Text1.Text
MsgBox MSComm1.OutBufferCount
MSComm1.PortOpen = False

'FOR READING

MSComm1.CommPort = 2
MSComm1.Settings = "9600,N,8,1"
MSComm1.PortOpen = True
MsgBox MSComm1.InBufferCount
MSComm1.InputMode = comInputModeText
'Text1.Text = MSComm1.Input
MsgBox MSComm1.Input
MSComm1.PortOpen = False

errHandler:
If Err.Number <> 0 Then
MsgBox "Error No: " & Err.Number & ", Error Description: " & Err.Description
End If
End Sub

kindly help
 
S

Sumathi Sampath Kumar

hi

We use Denso BHT 6000 barcode scanner. I have to write a program in visual basic 6.0 to download data from the scanner to the PC. There are some protocols specified in the manual. But, i dont know how to use it. I am trying with MSComm Control. Please help me.

Thanks
Sumathi
 
Normally, vb is event driven and PLC is sequence driven. Need to keep this in mind.

Your received seriel communication will trigger the "OnComm" event. i.e. "MSComm1_OnComm", this is were you put your code to read the input buffer and deal with it.

There are as many approaches as there are programmers. One methode I use is to set the buffer length to one. This will trigger an OnCommm event every time a character is received.

Private Sub MSComm_OnComm()
Dim Buffer As Variant
 
If I am using the keyboard connection for the scanner, what is the trigger event. It seems that the field is lock. Pls help me since it was too urgent to complete this project.

regards
VB beginner
 
I need help on this too. Appreciate if someone could help. my barcode is of code 39. How do I display the scanned data onto the textbox? I need to create a program to store scanned in part number into the Access database. thanks in advanced.
 
Get this book. It will tell you everything you need to know in about three pages. Also comes with a CD. Having this book will save a lot of time.

Amazon.com

Visual Basic Programmer's Guide to Serial Communications 3
 
i'm using a scanner that piggy-backs on the keyboard, it scans in numbers from barcodes fine in everything except the vb app i made, do i need something special for it to go into my vb text box?
 
G

Gregorio Cavazos

Maybe the your current focus is your problem, you need to have the pointer (focus) in a textbox in order to read the barcode and write the code in the textbox on focus.

Gregorio Cavazos C.
 
Hi All.

My Serial Bardcode Scanning Program using MSCOMM is working fine in Windows Local Com Ports.

How to use the Terminal Services Redirected Comm Ports TS002, TS003 etc.
 
<p>Assume that you are using keyboard wedge interface barcode scanner,

<ol>
<li>Create a new vb project
<li>In Form1, add a text box control(text1.text)
<li>In keydown event of text1.text, type as below

<pre>
Private Sub Text1_KeyDown( _
KeyCode As Integer,Shift As Integer)

select case keycode
case vbkeyreturn:
msgbox text1.text

end select

End Sub
</pre>

<li>that's all.
</ol>

<p>Good luck.

<p>kay
 
I created an app in use to scan our media, the code looks like this:

Private Sub txtInput_KeyPress(KeyCode As Integer)
If KeyCode = 13 Then 'Carriage Return
YourVariable = txtInput.Text
End If
End Sub

When using a keyboard attached scanner it is most likely a CR/LF is appended to the output. After the scan finishes all you need to do is deternmine the end of the string (carriage return) then read the textbox's text value. In the case of my program I created for my job, I use the scan to query the database.

Another way is to wait for the LostFocus event, this will usually occur after return is pressed.

Hope this helps.
 
Top