Public Class Tester
Shared Dim WithEvents Click3 As New TripleClicker
Public Shared Sub Main
Click3.Click()
Click3.Click()
Click3.Click()
End Sub
Private Shared Sub Click3_TplClick(ByVal Text As String) Handles Click3.TplClick
Console.WriteLine(Text)
End Sub
End Class
Public Class TripleClicker
Public Event TplClick(ByVal Text As String)
Public Sub Click()
Static intCount As Integer = 0
intCount += 1
If intCount >= 3 Then
intCount = 0
RaiseEvent TplClick("The button was triple clicked.")
End If
End Sub
End Class
|