谢谢大家,我找到了,在MSDN里面使用跳转URL到
mk:@MSITStore:D:\Program%20Files\Microsoft%20Visual%20Studio\MSDN98\98VSa\1033\vbcon98.chm::/Html/vbconaddingeventtoform.htm
看 Adding an Event to a Form
Private Sub Command1_Click()
Text1.Text = "From Now"
Text1.Refresh
Text2.Text = "0"
Text2.Refresh
Call mText.TimerTask(9.84)
End Sub
Private Sub Form_Load()
Command1.Caption = "Click to Start Timer"
Text1.Text = ""
Text2.Text = ""
Label1.Caption = "The fastest 100 meters ever run took this long:"
Set mText = New TimerState
End Sub
Private Sub mText_ChangeText()
Text1.Text = "Until Now"
Text2.Text = "9.84"
End Sub
Private Sub mText_UpdateTime(ByVal dblJump As Double)
Text2.Text = Str(Format(dblJump, "0"))
DoEvents
End Sub
The remaining code is in a class module named TimerState. Included among the commands in this module are the Raise Event statements.
Option Explicit
Public Event UpdateTime(ByVal dblJump As Double)
Public Event ChangeText()
Public Sub TimerTask(ByVal Duration As Double)
Dim dblStart As Double
Dim dblSecond As Double
Dim dblSoFar As Double
dblStart = Timer
dblSoFar = dblStart
Do While Timer < dblStart + Duration
If Timer - dblSoFar >= 1 Then
dblSoFar = dblSoFar + 1
RaiseEvent UpdateTime(Timer - dblStart)
End If
Loop