So, I'm trying to port a Visual Basic 6 software into the new dot NET.
My software is using the serial port via the code
My_form.Ser_port.Settings = "38400,n,8,1"
My_form.Ser_port.RThreshold = 1
If My_form.Ser_port.PortOpen = False Then
My_form.Ser_port.PortOpen = True
End If
Clearly, it seems that dot NET doesn't have such settings.
I have correctly imported the SerialPort1 componetn and I can see it on the bottom of my working area but, how can I open/Close and set the parameters as VB6? I see I can set the BaudRate, RecievedByesThreshold but there's no PortOpen option.
Does it opens automatically?
In your code (VB6) SerialPort.PortOpen is a property:
But in VB.NET it is not property, it is a sub of the component:
You have to call SerialPort.Open() or SerialPort.Close(). You can also get property if it's port open or no: SerialPort.IsOpen=True or False.
Here is an example how to work with serial port in VB.Net. If you worked with VS2022 you have to first install NuGet Package named System.IO.Ports.