我想制作一个具有计数器直到5的程序,当达到5时,它会自动点击一个按钮,并且每次达到5时必须一次又一次地从0到5计数。
下面的是我点击计时器的代码。
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer2.Tick
Dim ts As TimeSpan = TargetDT.Subtract(DateTime.Now)
If ts.TotalMilliseconds > 0 Then
lblTime2.Text = ts.ToString("ss")
Else
lblTime2.Text = "00"
Timer2.Stop()
btnRefresh.PerformClick()
End If
End Sub
Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
messagebox.show 'me dot click'
End Sub
结束班
答案 0 :(得分:0)
here is my solution to my question:
当计时器勾选时,我自动递增我的标签1-5,当它达到5时,它将返回0并再次计数1 - 5.并重复。然后可以做到达到0.希望可以帮助
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = Label1.Text + 1
If Label1.Text = "5" Then
Label1.Text = 0
btnRefresh.PerformClick()
End If
End Sub