直接声明 和C#一样
Private Sub RunScript(ByVal x As Boolean, ByVal y As Object, ByRef A As Object)
'your code goes here…
If s Then
timer = New System.Windows.Forms.Timer
timer.Interval = 100
AddHandler timer.Tick, AddressOf Timer_Tick
timer.Start()
s = False
End If
A = int
End Sub
'<Custom additional code>
Dim timer As System.Windows.Forms.Timer
Dim int As int32 = 0
Dim s As Boolean = True
Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
int += 1
If int > 100 Then timer.Stop():int = 0
owner.ExpireSolution(True)
End Sub
但是不幸的是C#可以直接+=来添加委托
而vb必须要AddHandler关键字
再就是第二种声明
Private Sub RunScript(ByVal x As Object, ByVal y As Object, ByRef A As Object)
If s Then
timer = New System.Windows.Forms.Timer
timer.Interval = 100
timer.Start()
s = False
End If
A = int
End Sub
'<Custom additional code>
Private WithEvents timer As System.Windows.Forms.Timer
Dim int As int32 = 0
Dim s As Boolean = True
Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles timer.tick
int += 1
If int > 100 Then timer.Stop():int = 0
owner.ExpireSolution(True)
End Sub