arduino+vb6

Private Sub Form_Load()
Dim mystr As String
Dim FoundIt As Integer
Dim ComFail As Integer
Dim FailErr As Integer
Dim n As Integer

MSComm1.Settings = "9600,N,8,1"
FoundIt = False
' find USB port
ComFail = False
FailErr = False
For n = 1 To 1
  If MSComm1.PortOpen Then MSComm1.PortOpen = False
   On Error Resume Next
   MSComm1.CommPort = 1
   On Error Resume Next
   MSComm1.DTREnable = True
    MSComm1.RThreshold = 4
    MSComm1.SThreshold = 3
   MSComm1.InputLen = 0
   MSComm1.PortOpen = True
Next
End Sub

the above code is what i edit using your code to find the comport...

  1. another thing is that, when i run the vb application and then hit the button it prompts an error in which i enclose in quote...then it points on the code above where i put a comment

Run-time error reading '8020':
Error reading comm device

Private Sub MSComm1_OnComm()
Dim strData As String
Static strBuffer As String
Dim strWords() As String
Dim intPos As Integer
Dim boComplete As Boolean
Dim mystr As String

        Sleep 1000 ' this waits one second between readings from the Arduino
        mystr = "" ' set the string to nothing
        mystr = MSComm1.Input  ////in this area the error points out
      
   
            intPos = InStr(mystr, "<")
            If intPos > 0 Then
           
                Select Case Mid(mystr, 1, 3) ' strip off the CR/LF
                    Case "<Y>"
                        Text1.Text = ("The pressures value is 80 psi")
                        Call LEDOn(&HFFFF&) ' this is in hex

i need some help on how to fix this..
thanks!