CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Handling Run Time Errors

    How do you handle run time errors ?
    The code I have included works if 'MSComm1.CommPort = 1'.
    When 'MSComm1.CommPort = 2' it throws up a run time error on certain machines where com port 2 is not available.
    How can I handle this error so that I give an error message say port not available and the program can carry on ?



    private Sub OptStart_Click()

    pac = 0
    state = 0
    execute = 0

    Timer1.Enabled = true 'START TIMER

    MSComm1.PortOpen = true 'OPEN COMM PORT

    static_send_packet 'SEND PACKET

    End Sub





  2. #2
    Join Date
    Apr 1999
    Location
    Netherlands
    Posts
    181

    Re: Handling Run Time Errors

    Check the helpfile for "on error", it will explain it pretty well what you can do to catch errors (on error resume next, or on error goto <label>...)

    Crazy D @ Work :-)

  3. #3
    Guest

    Re: Handling Run Time Errors

    Thanks for the help


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

Featured