hallo all..
i have question about connecting barcode scanner to vb6
how to connecting barcode scanner to vb6...
i use usb barcode scanner...
did i must set port or some code in vb6..???
or it works automatically..???
i need some code reference plsss...

Recommended Answers

All 13 Replies

It all depends on what scanner you have, what it will be used for etc....

Have a look at these few links, might help with what you need.

Here, Here or Here.

It seems that you will either have to reference to the drivers or it will be linked to your keyboard automatically, all depends on what you have.

It all depends on what scanner you have, what it will be used for etc....

Have a look at these few links, might help with what you need.

Here, Here or Here.

It seems that you will either have to reference to the drivers or it will be linked to your keyboard automatically, all depends on what you have.

hmm...
it's help.., but little...
now, my problem is, how to insert data or serial number after scan with barcode to textbox..

Show me what code you have so far, the connection, returned values etc.

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

Are you sure this is the correct approach, the barcode scanners I have used present the data as if it had been typed on the keyboard. ie. you set focus to a text box, scan the barcode and the barcode appears in the text box followed by a CR.

If you want to process the barcode you put some code in the LostFocus event of the text box.

hmm....
did barcode scanner work like keyboard..???
so after barcode scanner get the numeric of barcode, the numeric send into text1 ..??

Correct. Once the textbox you have that must contain the barcode value, use the scanner and it will return the value into the text box.

hmm..
thanks.., it's help me more...
so in the case use barcode scanner in usb, i don't need some code...
but in the other i need some code to connect barcode scanner to vb
is that right..??

The barcode scanner will have come with some drivers, install these and it should work as described above.

Generally it "just works". Most USB and ps2 scanners have "keyboard wedges". They are just seen by the OS as a keyboard.

good day sir..cdr-king laser barcode scanner hr100b is working for the vb6. and this code is compatible for this device?

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

hmm.
thanks for that information, its help me more for my thesis.
- but still i need the code to connect the bar code scanner to visual basic 6.0?
can you plz help me??

This thread is closed, please start a new one. Also you I believe you have the information you need above. It is for you to write the code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.