bycj.net
当前位置:首页 >> 怎样在VB编程中插入当前日期和时间? >>

怎样在VB编程中插入当前日期和时间?

下载文件:vs2010如果是其他版本,直接添加form1.vb到你项目.rar

具体代码: Private Sub Command1_Click() Text1.Text = Date Label1.Caption = "当前日期为:" End SubPrivate Sub Command2_Click() Text1.Text = Time Label1.Caption = "当前时间为:" End Sub 拓展资料 Visual Basic是一种由 Microsoft 公...

Private Sub Command1_Click() a = Array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) y = CInt(InputBox("请输入年份")) m = CInt(InputBox("请输入月份")) d = CInt(InputBox("请输入几号")) s = "今天是" & y & "年" & m & "月" & d...

你添加一个timer控件 Interval属性=100 添加事件 Private Sub Timer1_Timer() Text1.Text = Format(Now, "HH:MM:SS") End Sub

可以用Now(),不过只是获取当前时间, 如果要与系统时间同步,还需要用个定时器Timer()来执行获取系统时间: Print Date; "日期" Print Time; "时间" Print Now; "日期和日间" Print Format(Now, "yyyy年mm月dd日 hh时mm分ss秒") Print Year(Now); ...

方法1: Label1.Caption = Now() 方法2: Label1.Caption = Date & " " & Time()

代码几句 Private Sub Form_Load()Timer1.Interval = 1000End SubPrivate Sub Timer1_Timer()Text1 = Format(Now, "hh")Text2 = Format(Now, "mm")Text3 = Format(Now, "ss")Call bc(Text1, Text2, Text3)End SubSub bc(a As String, b As Strin...

用VB的Timer控件的Timer事件可随时更新TextBox文本框中显示的当前时间。 Timer 控件,通过引发 Timer 事件,Timer 控件可以有规律地隔一段时间执行一次代码。 Timer 事件,在一个 Timer 控件的预定的时间间隔过去之后发生。该间隔的频率储存于该...

Dim Dd As String Dim D As Integer, S As Integer, M As Integer, H As Integer Dim Da As String Private Sub Command1_Click() Dd = Format(Text1.Text, "yyyy/mm/dd hh:mm:ss") Timer1.Enabled = True End Sub Private Sub Form_Load() Time...

网站首页 | 网站地图
All rights reserved Powered by www.bycj.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com