在VB.NET中按一个按钮的时间/超时 [英] Time in/ time out in one button in VB.NET
本文介绍了在VB.NET中按一个按钮的时间/超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
即时通讯我想它会是这样的
i在vb.net上什么都不知道
我尝试了什么:
私人 Sub Button1_Click ( ByVal sender As System。 Object , ByVal e As System.EventArgs)句柄 Button1.Click
' timer1.start()
' label1将显示时间
' label1.text = DateTime.Now.ToString(hh:mm:ss tt)
' 当计时器当前处于活动状态并单击按钮
' label1现在将显示超时
' label1.text = DateTime.Now.ToString(hh:mm:ss tt)
结束 Sub
解决方案
这是非常基本的编程...你需要一个状态变量来跟踪按钮点击。
伪码:
1.表格等级变量:
< pre lang =text> IsActive = false
2:按钮点击事件:
if IsActive然后
IsActive = false
Timer.Stop
Button.Text =点击开始
else
IsActive = true
Timer.Start
Button.Text =点击停止
结束如果
could you guys help me, im making a timein/time out in vb.net using just a one button. that button control it all
im thinking it will be like this
i dont know anything in vb.net
What I have tried:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'timer1.start()
'label1 will show the time in
'label1.text = DateTime.Now.ToString("hh:mm:ss tt")
'while the timer is currently active and clicked the button
'the label1 will now display the time out
'label1.text = DateTime.Now.ToString("hh:mm:ss tt")
End Sub
解决方案
This is pretty basic programming... You need a state variable to track the button clicks.
Pseudo code:
1. form level variable:
IsActive = false
2: Button click event:
if IsActive then IsActive = false Timer.Stop Button.Text = "Click to start" else IsActive = true Timer.Start Button.Text = "Click to stop" end if
这篇关于在VB.NET中按一个按钮的时间/超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文