Scan Barcode Pada 1 Textbox

Pada propertis TextBox, set Multiline menjadi TRUE dan EnterKeyBehaviour TRUE

Private Sub TextBox1_Change()
    Dim v
    v = ScannedValue(TextBox1.Text)
    If Len(v) > 0 Then
        TriggerScanAction v
        TextBox1.Value = ""
    End If
End Sub
Function ScannedValue(vIn) As String
    Dim rv As String
    If Right(vIn, 2) = vbCrLf Then
        ScannedValue = Replace(vIn, vbCrLf, "")
    ElseIf Right(vIn, 1) = vbLf Then
        ScannedValue = Replace(vIn, vbLf, "")
    End If
End Function
Sub TriggerScanAction(v)
    MsgBox "You scanned " & v
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *

Chat WhatsApp
WhatsApp