Hello trying to build and API that will send data to COM6, 7 or 8 using the SerialPort component in the toolbox.
It works OK with COM1,2 or 3 but when I change it COM6,7 or 8 I get the following error: COM 6 or 7 or 8, does not exit .
here is my code
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
	
		
			
		
		
	
				
			It works OK with COM1,2 or 3 but when I change it COM6,7 or 8 I get the following error: COM 6 or 7 or 8, does not exit .
here is my code
			
				VB.NET:
			
		
		
		Imports System
Imports System.IO.Ports
Public Class Form1
   
 Dim WithEvents SerialPort1 As SerialPort = New System.IO.Ports.SerialPort("COM6", 115200, Parity.None, 8, StopBits.One)
    Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
        
        If Not (SerialPort1.IsOpen = True) Then
            SerialPort1.Open()
            SerialPort1.RtsEnable = True
            SerialPort1.DtrEnable = True
            SerialPort1.WriteTimeout = 100
            SerialPort1.Handshake = Handshake.None
        End If
        MessageBox.Show("Connected to the Serial Port")
       
        SerialPort1.WriteLine("a")
        
        MessageBox.Show("Wrote the char a in the serial port")
        
        Me.SerialPort1.Close()
        MessageBox.Show("Serial Port Closed")
    End Sub
    Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click
        Me.Close()
    End Sub
End Class