Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unitech MS336 Barcode scanner as VB.net input 1

Status
Not open for further replies.

bakershawnm

Programmer
Apr 18, 2007
84
US
In this thread thread796-690882 stnkyminky said:

'1. Set the scanner to send an "Enter" command after the barcode is read.'

I have searched everywhere for something specific to the Unitech MS336 and how to set this scanner to send an 'Enter' but have been unsuccessful.

Does anyone know a general means of forcing the 'Enter' or 'Tab' after the scanner scans?

What I am doing is scanning an employee id into a form. The employee id must always start with E0 and should be have 3 to 4 more numbers after the E0. I have set up a validation rule for the field and it works great if you leave the field. If you scan your badge to get the employee id it never leaves the field. I don't want the user to have to hit the enter or tab key after they scan. I want it to automatically go to the next field.

I liked stnkyminky's solution but Unitech's documentation has nothing in it for doing this (or maybe I just don't know what to look for in it cuz it is not obvious) and I cannot find anything else out there that will point me to it.

If there is a better solution than setting the barcode scanner to send the enter or tab than I am also open to that.

Oh I am using VS 2008 and .Net 3.5.

Thanks much
 
I had a similar challenge using a mag card reader
I think I ended up using a timer with a short interval (just long enough for all the data to show up in the text box) and started the timer on the textbox text changed.... then did my processing in the timer tick event.....

Probably not the best way to handle it but it has worked fine for years...
 
Could you post your code for the 'changed' event so I can see how you handled it?


Thanks
shawn
 
There really isn't much to the textchanted event....
On the timer tick I handle the string that came from the mag reader and pick out the parts of the card data that I want to use.


Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Timer1.Enabled = True
End Sub


Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim badread As String = "Swipe Card"

If InStr(TextBox1.Text, "==?") Or InStr(TextBox1.Text, "===?") Then
If Len(TextBox1.Text) = 72 Or Len(TextBox1.Text) = 73 Then
Swipe1.Text = Mid(TextBox1.Text, 3, 16)
Swipe2.Text = Mid(TextBox1.Text, 38, 16)
StopTimer()
Label1.Visible = True
Label1.ForeColor = Color.Green
Label1.Text = "Good Read"
TextBox1.SelectAll()
GetInfo(Swipe1.Text, Swipe2.Text)

Else
StopTimer()
TextBox1.Focus()
TextBox1.Text = ""
Swipe1.Text = ""
Swipe2.Text = ""
TextBox1.SelectAll()
Label1.Visible = True
Label1.Text = badread
Label1.ForeColor = Color.Red

End If
Else
StopTimer()
TextBox1.Focus()
TextBox1.Text = ""
Swipe1.Text = ""
Swipe2.Text = ""
TextBox1.SelectAll()
Label1.Visible = True
Label1.Text = "Swipe Card"
Label1.ForeColor = Color.Red

End If
End Sub
 
Well that was what I was afraid I would have to do.

I will try something like this and post if it works.

thanks
 
Your suggestion was perfect.

This is what I ended up with

Private Sub EmpID_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EmpID.TextChanged
TimerE.Enabled = True
End Sub

Private Sub TimerE_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerE.Tick

If Len(EmpID.Text) = 5 Or Len(EmpID.Text) = 6 Then
TimerE.Stop()
MoNum.Focus()

Else
TimerE.Stop()
EmpID.Focus()
EmpID.Text = ""

End If
End Sub

Have a star!! :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top