Serial LastErrorCode

  1. 6 days ago

    Graham S

    Apr 13 Pre-Release Testers UK

    I've been testing a serial port on Xojo and the LastErrorCode only ever seems to return 2.

    If I open a serial port thats already open I get LastErrorCode = 2 If I try and open a serial port that doesn't exist I get LastErrorCode = 2

    Should I expect it to return 101 when I try and open a port that doesn't exist and 101 when 100 when I open a port thats already open?

    Select Case Me.LastErrorCode
      
    Case Serial.AccessDenied   ' 100  
      
      ' Message Box
      MsgBox "The selected serial port could not be opened, access denied."
      
    Case Serial.PortNotFound   ' 101  
      
      ' Message Box
      MsgBox "The selected serial port could not be opened, port not found."
      
    Case Serial.InvalidOptions ' 102  
      
      ' Message Box
      MsgBox "The selected serial port could not be opened, invalid options."
      
    Case Serial.BreakCondition ' 103  
      
      ' Message Box
      MsgBox "The selected serial port could not be opened, BreakCondition."
      
    Case Serial.FramingError   ' 104  
      
      ' Message Box
      MsgBox "The selected serial port could not be opened, FramingError."
      
    Case Else
      
      ' Message Box
      MsgBox "The selected serial port could not be opened."
      
    End Select

or Sign Up to reply!