Yes, I finally got it to work. Thanks to Tracy I put a inkey(1) (at the beginning of the Oncomm) to wait a second so the buffer can clear itself out.
We can close this case now. 8-) Thanks again!!!
>First, the last thing you should be doing is THISFORM.buffer = "". Try something like this instead:
>
>if this.commevent = 2
> thisform.buffer = thisform.buffer + this.input
> * Assuming a CR at the end of the scan
> IF CHR(13)$THISFORM.inbuffer
> lnscansize = AT(CHR(13),THISFORM.inbuffer)
> * extract scan
> lcmydesiredscan = SUBSTR(THISFORM.inbuffer,1,lnscansize)
> *delete scan
> THISFORM.inbuffer = SUBSTR(THISFORM.inbuffer,lnscansize+1)
> ENDIF
>
>or something similar. This leaves the .inbuffer intact in the case there are multiple scans in the buffer.
>
>
>>I am still trying to figure out what is going on here. In the OnComm method I have
>>
>>if this.commevent = 2
>> thisform.buffer = ""
>> thisform.buffer = this.input
>>...
>>
>>
>>Then when I debug the first time it is fine. The second time it looks like it adds the input to the previous input but it is truncated. Not 2 complete data scans. What do I need to do to reset this object?
>>