Re: re-read of serial port takes 2+tries

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Dick Grier (dick_grierNOSPAM_at_msn.com)
Date: 12/21/04


Date: Tue, 21 Dec 2004 11:42:24 -0700

Hi,

I'm not sure what is actually wrong with your code. However, it has a
logical problem that may cause trouble. Try this (add it the OnComm event,
in place of what I assume is your current code, with the RThreshold property
= 1):

Static Buffer As String
    Buffer = Buffer & Comm1.Input
    If InStr(Buffer, vbCrLf) Then
        Text3.Text = Buffer
         Buffer = ""
    End If

That should be all that you need.

***

-- 
Richard Grier  (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 4th 
Edition ISBN 1-890422-28-2  (391 pages) published July 2004.  See 
www.mabry.com/vbpgser4 to order.

Quantcast