如何在Vb.Net中创建计时器 [英] How Do I Create Timer In Vb.Net

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

问题描述

我有这个我必须创建的程序。所以,基本上会有一个计时器将继续在后台运行。比如,每次用户按下单击按钮时,它会显示用户按下单击按钮的时间消息,当用户单击退出按钮时,计时器会在用户退出表单时再次显示时间。



有没有办法可以做到?

I have this program which i have to create. So, basically there will be a timer which will keep running in the background. Say, every time the user presses a click button,it shows a message of the time the user has pressed the click button and when the user clicks the exit button, the timer shows the time again when the user exited the form.

Is there a way that i can do it?

推荐答案

你不需要计时器。您只需处理按钮点击事件(例如:点击事件 [< a href =http://www.homeandlearn.co.uk/NET/nets10p1.htmltarget =_ blanktitle =New Window> ^ ])并显示 DateTime.Now Property [ ^ ]。

您还应该处理表格 OnClosing [ ^ ]事件。
You don't need a timer for that. You just need to handle a button click event (see, for instance: "The Click Event"[^]) and show the time provided by DateTime.Now Property[^]).
You should as well handle the form OnClosing[^] event.


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

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