在Timer的间隔中添加额外的秒数

时间:2014-09-20 17:51:28

标签: vb.net timer

据说,我有一个值为5000(5秒)的计时器。 5秒后,

Radiobutton1.Enabled = False
Radiobutton2.Enabled = False

将被锁定。我想要发生的是当我点击某个按钮时,(例如Button1),它将再添加2000(2秒),我的Radiobuttons 1和2将再次启用。

我的Timer1代码如下所示:

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

        Timer1.Stop()
        RadioButton1.Enabled = False
        RadioButton2.Enabled = False
End Sub

1 个答案:

答案 0 :(得分:1)

在按钮点击事件中添加:

Timer1.Interval += 2000
RadioButton1.Enabled = True
RadioButton2.Enabled = True
Timer1.Enabled = True 'If you want to start the timer again