如何在模块上创建当前日期时间? [英] How to create current datetime on module ?
本文介绍了如何在模块上创建当前日期时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试在模块上创建日期时间,但是当我尝试在文本框上检查它时,第一次就停留了..为什么不喜欢
I try to create datetime on module but when i try to check it on textbox the time just stuck in first time.. Why not like
tb1.text = datetime.now.tostring("MM/dd/yyyy HH:mm:ss")
我尝试了什么:
我在模块中的代码
What I have tried:
This my code in module
Public actdate As Datetime = Datetime.Now.ToString("MM/dd/yyyy HH:mm:ss")
推荐答案
因为你只设置一次:它确实不会自动改变以反映实际时间,比你带Sharpie并在显示器上写下时间更多。
有时间总是反映出来当前值,你需要使用一个更改TextBox值的计时器 - 可能是每秒两次。具体如何做到这取决于您的代码所处的环境 - 我们不知道那是什么!
Because you are only setting it once: it does not automatically change to reflect the actual time, any more than it would if you took a Sharpie and wrote the time on your monitor.
To have a time that always reflects the current value, you need to use a timer which changes the TextBox value - probably twice a second. Exactly how you do that depends on the environment your code is working in - and we have no idea what that is!
这篇关于如何在模块上创建当前日期时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文