mscomm input question 
Author Message
 mscomm input question


I am connected to a terminal session through vb6 and I am sending out
commands, however I am waiting for a particular response before I execute
another set of commands.

What is the best way to do that?

I used something similar to the code below with bad results, where am i
going wrong?

do until
mscomm1.input = "end"

Yep I am a newbie.


Sun, 29 Aug 2004 23:29:46 GMT  
 mscomm input question

do until
mscomm1.input = "end"

Should look more like this:

Dim Buffer As String
Dim Succeed As Boolean
Do 'until Timeout = True, perhaps
    Buffer = Buffer & MSComm1.Input
    If InStr(Buffer, "end") Then
        Succeed = True
        Exit Do
    End If
If Succeed = True Then 'etc

You need to add DoEvents inside this loop.  You also may want to add a
method for waiting until some time has expired and return an error if a
response is not received before that time has expired.

I have lots more information, and working example code in my book.  See

Richard Grier  (Microsoft Visual Basic MVP)
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO  80228
303-986-2179 (voice)
303-986-3143 (fax)
Leave voice mail or fax that I can receive as email at 303-593-9315
Author of Visual Basic Programmer's Guide to Serial Communications, 3nd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
For information look on my homepage at
Use the Books link to order.  For faster service contact the publisher at .

Mon, 30 Aug 2004 01:40:25 GMT  
 [ 2 post ] 

 Relevant Pages 

1. mscomm.input question

2. MScomm, MSComm.Input

3. MSComm Binary input problem

4. Unicode & mscomm.input

5. Mscomm in VB60 serial input help

6. Need help reading the MSComm input buffer

7. MSComm input/output buffers

8. MSComm and parsing the input buffer

9. help on MSCOMM, do es not read from input buffer

10. MSCOMM Serial Input from GPS

11. Need Help on MSComm input buffer

12. MSComm.Input problem


Powered by phpBB® Forum Software