Chapter 10
The routine can check to find out which pin has changed state and take action
as needed. This example just displays information about the event:
Friend Sub PinChanged(ByVal sender As Object, ByVal e As SerialPinChangedEventArgs)
Dim SerialPinChange1 As SerialPinChange
Dim signalState As Boolean
SerialPinChange1 = e.EventType
Select Case SerialPinChange1
Case SerialPinChange.Break
Console.WriteLine("Break is set")
Case SerialPinChange.CDChanged
signalState = myComPort.CDHolding
Console.WriteLine("CD = " & signalState)
Case SerialPinChange.CtsChanged
signalState = myComPort.CtsHolding
Console.WriteLine("CTS = " & signalState)
Case SerialPinChange.DsrChanged
signalState = myComPort.DsrHolding
Console.WriteLine("DSR = " & signalState)
Case SerialPinChange.Ring
Console.WriteLine("Ring detected")
End Select
End Sub