Hello!
I am working on a little program that counts changes in the serial port CD line.
I have connected pin 4 (DTR) and pin 1 (DCD) to a button and I am trying to make a program that counts how many times button is pressed. Here is the code:
Code:
Private Sub Form_Load()
With MSComm1
    .CommPort = 1
    .Settings = "9600,n,8,1"
    .SThreshold = 1
    .RThreshold = 1
    .Handshaking = comXOnXoff
    .PortOpen = True
  End With
End Sub
Private Sub MSComm1_OnComm()
  Select Case MSComm1.CommEvent
Case comEvCD
     If MSComm1.CDHolding = True Then
Label1.Caption = Val(Label1.Caption) + 1
End If
End Select
End Sub
When button is pressed the label1 should show +1, but the problem is that the label1 sometimes show +2 or even +3 after button is pressed only once. I am very new to vb programing so I was wondering if someone could please tell me if this is possible, and if it is some code would be very helpful. Thank You in advance!