着个代码对么,谁能帮我纠正一下

来源:百度知道 编辑:UC知道 时间:2024/07/01 06:16:27
Private Sub Timer1_Timer()
Dim 1hour as Long
1 Hour = Hour(Time)
If 1hour>=0 And 1hour<12 Then
label2.Caption=“上午”
Else
label2.Caption=“下午”
End If

Label1.Caption = Time

End Sub

1.变量1hour定义格式有错
第一字符不能出现数字 可以改为hour1
2.定义好timer空间的Interval值 100 就可以得到结果了~
如:
Dim hour1 As Long
hour1 = Hour(Time)
If hour1 >= 0 And hour1 < 12 Then
Label2.Caption = "上"
Else
Label2.Caption = "下"
End If

Label1.Caption = Time

1、变量定义开头不能用数字
2、timer1的interval没有计定时长

Private Sub Form_Load()
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
Dim hour As Long
hour = Time
If hour >= 0 And hour > 12 Then
Label2.Caption = "上午"
Else
Label2.Caption = "下午"
End If

Label1.Caption = Time

End Sub

主要错误就是变量 的命名不符合VB的游戏规则 .. ^&^

Private Sub Form_Load()
Timer1.Interval = 100
End Sub

Dim hour1 As Long
hour1 = Hour(Time)
If hour1 >= 0 And hour1 < 12 Then
Label2.Caption = "上午"
Else
Label2.Caption = "下午&q