Hello
I am very new to .net and I am trying to figure out the best way to get a list of all of the currently available com ports. I have tried some code I found on the forum and it isn't working.
Dim ports As String() = SerialPort.GetPortNames()
Dim port As String
Dim x As SerialPort
For Each port In ports
x = port
If x.IsOpen Then
MessageBox.Show("hello")
End If
Next port
it says that the port string cannot be saved to x
Any ideas as to how I can correct this or do it better. Thanks!
I am very new to .net and I am trying to figure out the best way to get a list of all of the currently available com ports. I have tried some code I found on the forum and it isn't working.
Dim ports As String() = SerialPort.GetPortNames()
Dim port As String
Dim x As SerialPort
For Each port In ports
x = port
If x.IsOpen Then
MessageBox.Show("hello")
End If
Next port
it says that the port string cannot be saved to x
Any ideas as to how I can correct this or do it better. Thanks!