Hi, could anyone please identify any errors witin this chunk of code, or share some code that opens a connection to a serial port. This code gives me an error at run time:
System.IO.IOException: The parameter is incorrect
at System.IO.Ports.Internalresources.WinIOError(Int 32 errorCode, String str)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If serialPort.IsOpen Then
serialPort.Close()
End If
Try
With serialPort
.PortName = "com1"
.BaudRate = 96000
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
.Handshake = IO.Ports.Handshake.RequestToSendXOnXOff
End With
value = serialPort.ReadTimeout
serialPort.ReadTimeout = value
serialPort.Open()
lblMessage.Text = "connected"
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class