The barcode scanners alway can be set to add a <CR> after the msg.
e.g. It connected to your PC's COM2, the communication speed is 9600.
A 'Comm' control named Serial2 placed in a form, property 'TThreshold'
is set to 1.
Wirte code for Serial2_OnComm event:
static barCode as string
dim oneCode as string
select case serial2.commevent
case comEvReceive
oneCode = serial2.input
if asc(oneCode) = 13 then
if barCode <> "" then
Process barCode
barCode = ""
end if
else
barCode = barCode + oneCode
end if
case else
end select
You can also write some code in a Timer's events