SerialConnection component

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

SerialConnection.Device = SerialDevice.WithName("COM3")

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

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

[code]Try
Dim dummy As Boolean = SerialConnection1.Connect

some code to communicate with serial port

Catch error As IOException

error handling code

End Try[/code]

EDIT: relevant feedback cases: <https://xojo.com/issue/57945> <https://xojo.com/issue/57838> <https://xojo.com/issue/57844>

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