Results 1 to 3 of 3

Thread: comm

  1. #1
    cool_rockz
    Guest

    comm

    I use the followin to read buffer continuesly:

    Do
    Dim instring As String
    Loop Until MSComm1.InBufferCount = 1


    I would like the code to keep reading the buffer untill I press a stop command.However using the above code means the while the buffer being read the rest of the form is frozen and any command button wont be enable to be clicked.

    Even this wont work:
    Do
    Dim instring As String
    Loop Until MSComm1.InBufferCount = 1 or cmd_stop = true

    all buttons are lock while buffer is being read...
    how can I over come this???

  2. #2
    Addicted Member
    Join Date
    Apr 2000
    Location
    England
    Posts
    246
    Do
    Dim instring As String
    doEvents
    Loop Until MSComm1.InBufferCount = 1 or cmd_stop = true
    Some Days, i just get this feeling that i'm helping to write dozens of Viruses...

  3. #3
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    I wouldnt declare the variable inside the loop ...

    Code:
    Option Explicit
    Private inString As String
    
    Do 
        DoEvents
    Loop Until (MSComm1.InBufferCount = 1) Or cmd_stop
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width