Public cur_hour
Private Sub Form_Load()
For i = 0 To 23
Text1(10) = 10 '假设你的24个压力值为0-23,也可以手动赋值
Next
End Sub
Private Sub Command1_Click() '使能按钮
cur_hour = Val(Hour(Now)) '选择当前小时
Text10.Text = Text1(cur_hour) '选择当前小时压力值赋值给text10
Call set1 '进行第一次压力处理
Timer1.Interval = 1000 '开启定时器
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If cur_hour <> Val(Hour(Now)) Then '如果是同一小时,不做处理
cur_hour = Val(Hour(Now)) '记录当前小时,执行压力处理
Text10.Text = Text1(cur_hour) '选择当前小时压力值赋值给text10
Call set1
End If
End Sub
Private Sub set1()
'压力处理程序
End Sub