如何在VB中创建简单TIMER [英] How to create Simple TIMER in VB

查看:123
本文介绍了如何在VB中创建简单TIMER的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨大家需要帮助。



你能帮我创建一个简单的计时器。

例子。我有组合框。值为开始和暂停

如果我选择启动计时器将启动,如果我选择暂停,基本上计时器将暂停,如果我再次选择启动计时器将重新启动。



谢谢!

解决方案

尝试

Timer [ ^ ]

定期示例 [ ^ ]

使用计时器 [ ^ ]


希望它能让您了解如何使用它。

VB中的计时器


< blockquote>

 私有 共享  WithEvents  timer1  As   System.Windows.Forms.Timer()' 或者您可以从工具箱中拖动它 

表单加载事件'
timer1.interval = 100
combobox1.item.add( 开始
Combobox2.item.add( 暂停

' 关于组合框索引更改事件

如果 combobox1.text = 开始 然后
timer1.start()
ElseIf combobox.text = 停止 然后
timer1。 stop ( )
结束 如果



私有 共享 Sub timer1_tick(myObject < span class =code-keyword>作为 [对象],myEventArgs As EventArgs) _
句柄 myTimer.Tick

' 将代码粘贴到此处

结束


Hi Guys need help.

Can you help me create a simple timer.
Example. I have combo box. with a value of Start and Pause
If I choose Start the timer will start and if I choose Pause basically the timer will pause and if I choose again Start the timer will start again.

Thanks!

解决方案

Try
Timer[^]
Timer Example[^]
Using Timer[^]


Hope it gives you an idea how to use it.
Timer in VB


Private Shared WithEvents timer1 As New System.Windows.Forms.Timer() ' or you can drag it from tool box

'on forms load event
timer1.interval = 100
combobox1.item.add("Start")
Combobox2.item.add("Pause")

'on combobox index change event

If combobox1.text = "Start" then
timer1.start()
ElseIf combobox.text = "Stop" then
timer1.stop()
End If



Private Shared Sub timer1_tick(myObject As [Object], myEventArgs As EventArgs) _
    Handles myTimer.Tick
     
'paste your code here

End Sub


这篇关于如何在VB中创建简单TIMER的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆