VB6.0时间问题
答案:1 悬赏:10 手机版
解决时间 2021-01-27 14:40
- 提问者网友:不要迷恋哥
- 2021-01-26 20:03
VB6.0时间问题
最佳答案
- 五星知识达人网友:雪起风沙痕
- 2021-01-26 21:01
在窗体中设置一个文本框控件、一个定时器控件,复制以下代码,就可以运行:
Dim h As Integer, m As Integer, s As Integer
Private Sub Form_Load()
Text1.FontSize = 20
Text1.FontBold = True
Text1.Alignment = 2
Text1.Text = Format(Now, "HH:MM:SS")
h = CInt(Left(Text1.Text, 2))
m = CInt(Mid(Text1.Text, 4, 2))
s = CInt(Right(Text1.Text, 2))
Timer1.Interval = 1000
m = m + 10
If m >= 60 Then
m = m - 60
End If
End Sub
Private Sub Timer1_Timer()
Dim m1 As Integer, s1 As Integer
Text1.Text = Format(Now, "HH:MM:SS")
m1 = CInt(Mid(Text1.Text, 4, 2))
s1 = CInt(Right(Text1.Text, 2))
If m = m1 And s = s1 Then
Text1.BackColor = vbYellow
End If
End Sub
Dim h As Integer, m As Integer, s As Integer
Private Sub Form_Load()
Text1.FontSize = 20
Text1.FontBold = True
Text1.Alignment = 2
Text1.Text = Format(Now, "HH:MM:SS")
h = CInt(Left(Text1.Text, 2))
m = CInt(Mid(Text1.Text, 4, 2))
s = CInt(Right(Text1.Text, 2))
Timer1.Interval = 1000
m = m + 10
If m >= 60 Then
m = m - 60
End If
End Sub
Private Sub Timer1_Timer()
Dim m1 As Integer, s1 As Integer
Text1.Text = Format(Now, "HH:MM:SS")
m1 = CInt(Mid(Text1.Text, 4, 2))
s1 = CInt(Right(Text1.Text, 2))
If m = m1 And s = s1 Then
Text1.BackColor = vbYellow
End If
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯