VB.NET 2010 如何在类Class1中调用timer事件 触发 的方法

Public Class Class1
Private WithEvents MyTimer As New Timer
Private intSum As Integer

Public Sub New(ByVal intInterval As Integer)
MyTimer.Interval = intInterval 'intInterval设置为1000 就是间隔1秒
MyTimer.Enabled = True '启动Timer
End Sub

Private Sub MyTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyTimer.Tick
'***********在此处加上你要操作的代码************Start
intSum = intSum + 1 '如累加intSum的值
'***********在此处加上你要操作的代码************End
End Sub

 

posted on 2012-04-06 22:03  webzhuazi  阅读(659)  评论(0编辑  收藏  举报

导航