Re: MScomm controls

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Chris A. Kusmierz (cakusmierz_at_adelphia.net)
Date: 10/11/04


Date: Mon, 11 Oct 2004 00:12:45 -0400


"Neil" <nkaufman@charter.net> wrote in message
news:10mh1egkd5cln34@corp.supernews.com...
> Does anybody know what the command is for clearing the receive buffer when
> using MScomm. What's the best way to sort out data similiar to the
> following string that's in the receive buffer?
>
> @@@ 1048 LB 000 CN 5678 ID
>
> The first 4 characters are junk. I only want to keep the "1048" and the
> "5678" sets. The rest I don't need.
>
> thanks
>
>

Dim Receive as String
Dim V1 as String, V2 as String

MSComm1.InputLen=0
' assuming you've sorted out how to wait for the whole data stream
Receive=MSComm1.Input
V1=Mid$(Receive,5,4)
V2=Mid$(Receive,20,4)

HTH
Chris A. Kusmierz

P.S. The first 3 bytes of the data stream are probably bit level status
flags. Check the documentation for the equipment transmitting the data, if
it matters to you.



Relevant Pages

  • =?iso-8859-1?Q?Bild_=FCber_TCP-Verbindung_=FCbertragen?=
    ... Private Sub SendData(ByVal data As String) ... Dim writer As New IO.StreamWriter ... Static Buffer As String ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: GetOpenFileName with multi-select and typelib
    ... Private strResult As String ... Dim strF As String ... 'Get size of buffer required for filespec. ... PickFileFolder = BuildCSVMultiString ...
    (microsoft.public.vb.general.discussion)
  • Re: Random String for passwords
    ... Dim pw As New Collection ... Dim Buffer As String ... ' Set up buffer to recieve passwords. ...
    (microsoft.public.vb.general.discussion)
  • Ever wondered how to work with large text imports >256 columns?
    ... Then, for the columns I needed in an Excel Worksheet, I wrote a little VBA function to get those columns from a string that contains a whole tab-separated row, as stored in column 1 now. ... Dim col As Integer ... Dim pos As Long ... Dim buffer As String ...
    (microsoft.public.excel.programming)
  • Re: Multiple results from query
    ... Dim BomItemId As String ... Dim cnn As ADODB.Connection ... Dim rst As ADODB.Recordset ... Dim buffer As String ...
    (microsoft.public.access.queries)