Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
Label1.Text += 1
Timer2.Enabled = False
End Sub
我不明白为什么这不起作用,我自己也无法弄明白。请帮忙?
答案 0 :(得分:0)
我不确定你要完成什么。如果要将值递增1并将其显示在Label1上,请尝试以下代码: -
int count = 0;
count = count + 1;
Label1.Text = count;
答案 1 :(得分:0)
如果您希望Label1
每tick
增加一次,那么您会想要做这样的事情
Dim count as integer
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
count = count + 1
Label1.Text = count.ToString()
Timer2.Enabled = False
End Sub
如果当然你必须在某处重新启用你的计时器,以便再次调用tick
事件。