I was wondering if Someone could spot where I have gone wrong
what I want to do is convert a small BASIC code snip to Gambas (as this worked perfectly for handling barcode scanner input on my old FreeBASIC version of my Point of sale system)
This is the Code that I have come up with so far
Code: Select all
Dim ScannerPrefix As String = "^C"
Dim Buffer As String = Null
Do While Lof(RS232Scanner) > 0
Buffer = ""
buffer = Read #RS232Scanner, 1
If buffer <> Chr(Val(ScannerPrefix)) Then
Dim a As String = buffer
Dim result As String
For x As Integer = 0 To Len(a) - 1
If InStr(Chr(a[x]), any "0123456789" Or Chr(Val(ScannerPrefix))) Then
result += Chr(a[x])
End If
Next x
datareceived += result
End If
If buffer = Chr(Val(ScannerPrefix)) Then 'tells NPOS the scanner is done
If RemoveNumber > 0 Then
Dim Temp As String = Mid(datareceived, RemoveNumber, Len(datareceived))
datareceived = ""
datareceived = Temp
End If
ScannerFucntionSub(datareceived)
datareceived = ""
End If
Loop
I thought this was going to something easy to convert but I have been trying to work this out for 2 hours now any help would be most welcomed