SerialConnection component

  1. 3 weeks ago

    In the new version software R2.1 is the new component SerialConnection, which should be used instead of component Serial. In the new component I didn't found, how is possible to directly write (set) the name of used ComPort. In the old component Serial, it was posible -> Serial.SerialPort=System.SerialPort("COM3").
    How is possible to directly write the name of used ComPort in the new component SerialConnection ?
    In the forums and helps I found only how to detect name of ComPort from index value.
    Thx

  2. Krzysztof M

    Nov 23 Silesia, Poland
    SerialConnection.Device = SerialDevice.WithName("COM3")
  3. 2 weeks ago

    Thank you very much, but I have next one problem with opening Com Port. In the help is:

    Try
    SerialConnection1.Connect -------------------------------- this command doesn't work, like is wrote in the help
    MessageBox("The serial connection is open.")
    Catch error As IOException
    MessageBox("The serial connection could not be opened.")
    End Catch

    The consequence of the command "SerialConnection1.Connect" is error message "You must use the value returned by this function". In the help it looks like the command, why is needed returned value ? When I'll use e.g.:

    Dim ii as Boolean
    ii=SerialConnection1.Connect ---------------- then the line is without errors, but every time the result is False, even if the selected ComPort exist.

    Please does anybody know, how create command Connect, or it is software bug in a new version ?

    Thx

  4. Krzysztof M

    Nov 28 Silesia, Poland
    Edited 2 weeks ago

    That's a known bug. So far in my code I just use dummy variable to store the result:

    Try
      Dim dummy As Boolean = SerialConnection1.Connect
    # some code to communicate with serial port
    Catch error As IOException
    # error handling code
    End Try

    EDIT: relevant feedback cases: Feedback Case #57945 Feedback Case #57838 Feedback Case #57844

  5. Derk J

    Nov 28 Pre-Release Testers, Xojo Pro

    You can also use the "Call" operator before any function that returns any value if you want to ignore the result

or Sign Up to reply!