Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There is a way to differentiate between keyboard and USB barcode reader </p> <p>You can depend on these facts:</p> <ol> <li>the code scanned by barcode reader in minmum 4 characters</li> <li>the code scanned by barcode reader ends with RETURN "ENTER"</li> <li>it take less than 50 mseconds to scan the hole barcode</li> </ol> <p>This is a simple form using VS2005 VB contains:</p> <ol> <li>textbox1</li> <li>textbox2</li> <li>textbox3</li> <li>Button1</li> <li>Timer1 "the time interval set to 50"ms"</li> </ol> <hr> <pre><code>Public Class Form1 Dim BarcodeStr As String = "" Dim IsBarcodeTaken As Boolean = False Dim Str As String = "" Dim str3 As String = "" Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown If Timer1.Enabled = False Then Str = TextBox1.Text str3 = TextBox3.Text End If End Sub Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress If Timer1.Enabled = False Then Timer1.Enabled = True End If BarcodeStr = BarcodeStr &amp; e.KeyChar If Asc(e.KeyChar) = 13 And Len(BarcodeStr) &gt;= 4 Then IsBarcodeTaken = True TextBox2.Text = BarcodeStr End If End Sub Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp If IsBarcodeTaken = True Then TextBox1.Text = Str TextBox1.Select(Len(TextBox1.Text), 0) Str = "" TextBox3.Text = str3 TextBox3.Select(Len(TextBox3.Text), 0) str3 = "" End If End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick BarcodeStr = "" IsBarcodeTaken = False Timer1.Enabled = False End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox2.Text = "" End Sub End Class </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload