Hi,
I donot know if this is what you are lookng for " trapping a <CR><LF>
in this case we bring in a string and extract the ASCII data from a specific
character to the <CR><LF> effectively trimming it off.
This is how we have read a Symbol LS2208 barcode scanner
This form has an Exit command button on it to be able to terminate the timer,
close the comm port and move to another screen.
' Hidden Text box used for Heartbeat in Barcode Scanning
AddObject "TextBox","Trigger",200,300,350,90
'Trigger.Timer = 500 will be started
'Trigger.Timer = 0 stops the heartbeat
Trigger.hide
Trigger.Timer = 500
'-----------------------------------------------------------------------
Sub Trigger_Timer
' Trigger timer pulses every 500 ms To allow Barcode reading And an exit while
Comm is reading
On Error Resume Next
If (com_port3.InBufferCount > 0) Then
Mpic6.Cls ' every Barcode received Scan the MPic6 box will clear.
ScanTwo = com_port3.Input
ScanTwo = Trim(ScanTwo) ' remove any leading or trailing spaces
' reject any scans other than STID, CAPS, DUMY, and EXP
If (Mid(ScanTwo,1,4) = "CAPS") Or (Mid(ScanTwo,1,4) = "STID") Or
(Mid(ScanTwo,1,4) = "DUMY") Or (Mid(ScanTwo,1,3) = "EXP") Then
'Parse for "CAPSxxxxxxx"
If (Mid(ScanTwo,1,4) = "CAPS") Then
PosCR = InStr(1,ScanTwo,Chr(13))' what position is the carrage
return
PosC = InStr(1,ScanTwo,"C") ' what position is the C in CAPS , 0 if no C
If PosC <> 0 Then
NameLen = PosCR - PosC ' Characters of the CAPS Name between the
first character C and the CR
ScanOne = Mid(ScanTwo,PosC,NameLen) ' strip off <CR><LF>
End If
End If
End If
End If
Hope this helps.
Ben
--- In [email protected], "manic4basic" <manic4ba...@...> wrote:
>
>
>
> Has anyone found the answer on how to trap for a CR from the Key Preview
> function?
>
> I can see any Alph or Num keys but am having trouble trapping the CR or LF
> keys.
>
> I have turned on the textbox multiline so it will respond to the cr but I
> cannot trap it out. When I use a barcode scanner I need to decode the input
> string and place that data into one of several textboxes depending on it's
> value.
>
> I know others have done this but cannot find any examples.
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nsb-ce" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nsb-ce?hl=en
-~----------~----~----~----~------~----~------~--~---