自动更新now.date值 [英] Auto update now.date value

查看:117
本文介绍了自动更新now.date值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个容易解决的问题。我有一个文本框,使用

This might be an easy problem to resolve. I have a text box that gets populated with the current date using

DateTime.Now.ToString("MM/dd/yyyy")

。我的问题是当应用程序运行时如何创建循环以使该字段在应用程序运行过夜并且Now.Date已更改时再次自动填充日期?



我的尝试:



我还没有厌倦任何东西,但想知道什么会更好IF循环语句或计时器样式会更好。

. My question is when the application is running how do I create a loop to have that field auto populate the date again if the application is running over night and the Now.Date has changed?

What I have tried:

I have not tired anything as of yet, but wondering what would be better a "IF loop" statement or a timer style would better.

推荐答案

添加计时器工作
myTimer.Enabled = True
        myTimer.Interval = 1000

and

Private Sub myTimer_Tick(sender As Object, e As EventArgs) Handles myTimer.Tick

    TextBox5.Text = DateTime.Now.ToString("MM-dd-yyyy")

End Sub


这篇关于自动更新now.date值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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