Run-time error '8020' Error reading comm device
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: Run-time error '8020' Error reading comm device

  1. #1
    Join Date
    Oct 2005
    Posts
    113

    Run-time error '8020' Error reading comm device

    hi,

    how to solve Run-time error '8020' - (Error reading comm device )

    any ideas?

    thanks

  2. #2
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Re: Run-time error '8020' Error reading comm device

    Please show how you have declared the connection and how you are attempting to open the port

    Also check this out

    http://support.microsoft.com/default...b;en-us;318784
    If you find my answers helpful, dont forget to rate me

  3. #3
    Join Date
    Oct 2005
    Posts
    113

    Re: Run-time error '8020' Error reading comm device

    hi,

    This is my port setting procedure. Is anything wrong?
    Some times i'm getting " Set comm state failure error" too.

    Private Sub Form_Load()
    With MSComm1

    .CommPort = 1
    .RThreshold = 1
    .Settings = "38400,n,8,1"
    .InputLen = 0
    .SThreshold = 1
    .InBufferCount = 0
    .OutBufferCount = 0
    .PortOpen = True
    End If

    MSComm1.Output = Chr(65) + Chr(80) + Chr(48) + Chr(13)
    End With

    Waiting for ur suggestions.
    Thank you.

  4. #4
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Re: Run-time error '8020' Error reading comm device

    There's nothing obviously wrong with the way you are handeling the port. However it may be worth check the Device instructions to ensure that you are using the right kind of 'handshaking'.

    Set comm state failure error - often occurs when the 'handshake' is in-correct.

    i.e. you might be using odd parity when it should be even.
    If you find my answers helpful, dont forget to rate me

  5. #5
    Join Date
    Dec 2006
    Posts
    13

    Angry Re: Run-time error '8020' Error reading comm device

    OK, I know this has been a long time ago. but.... I am using VB5 and have had very good luck with my past Serial comms to 10-20 different RS-232 devices (including USB CDC devices). NOW.. I have a new device to talk to, a "NovAtel GPS systems" ,and my comm problems are the Runtime error 8020. Hyperterminal works fine, but any demo, sample, example, including -my existing Comm programs do not work.

    If anybody is still out there monitoring this thread, what do you suggest? I have even thought about using Hooks into Hyperterminal DLL to see if I could get something to work.

    Thanks
    Keith

  6. #6
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,999

    Re: Run-time error '8020' Error reading comm device

    Well, get rid of VB5 for one thing. VS2010 is out, and the Express versions are FREE
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  7. #7
    Join Date
    Dec 2006
    Posts
    13

    Re: Run-time error '8020' Error reading comm device

    OK, I tried that, now... all my existing code doesn't load under VB2010. I can not expand my current VB5 programs into VB2010. Am I gonna have to re-write all my existing code to make it run under 2010? Not very efficient.


    Also, is there any simple COM terminal examples that I can build off of, since MSComm is gone, but Serial seems to be what to use in 2010.

    Keith
    Last edited by ch701builder; March 7th, 2011 at 01:27 PM.

  8. #8
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,999

    Re: Run-time error '8020' Error reading comm device

    Even VB6 isn't upward compatible, in most cases. You're still better off re-writing in most cases, to utilize the newer features of the Net Framework.

    It's not hard to open a port in VB.Net. See MSDN, and the link in my signature for 101 Samples
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  9. #9
    Join Date
    Dec 2006
    Posts
    13

    Re: Run-time error '8020' Error reading comm device

    I have written a quick COM program that seems to be working ok. now.... quick question:

    What is the equivalent to VB 'unload'? This gets called when there are things you want done when the program quits.

    I tried me.close() and me.dispose() but I get errors on each of these.

    I want the program to stop running and self terminate - quit when it is done... any ideas?

    Keith

  10. #10
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,999

    Re: Run-time error '8020' Error reading comm device

    Write a CONSOLE app to call the COM and exit
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  11. #11
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Run-time error '8020' Error reading comm device

    Quote Originally Posted by ch701builder View Post
    What is the equivalent to VB 'unload'? This gets called when there are things you want done when the program quits.

    I tried me.close() and me.dispose() but I get errors on each of these.
    Me.Close is one of the correct methods.. however you have to ensure that you wrap up everything before you issue it ...

    IE: Stop all timers. Release all bound objects, Close the Com port, etc ...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center