Private Sub Timer1_Timer()这段代码的意思?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Private Sub Timer1_Timer()这段代码的意思?相关的知识,希望对你有一定的参考价值。

Private Sub Timer1_Timer()

Dim a As Integer
Timer1.Interval = 500

StatusBar1.Panels(3).Text = " " & Str(Now) & " "

a = a + 1
If a > 5 Then
a = 1

End If
Select Case a
Case 1, 3, 5
StatusBar1.Panels(1).Text = " 欢迎使用公安110接处警系统 版本 V1.0! 此系统有石油大学计算机系制作 "
Case 2, 4
StatusBar1.Panels(1).Text = ""

End Select

End Sub

Private Sub Timer1_Timer()

Dim a As Integer
Timer1.Interval = 500 //设置timer控件周期为500毫秒

StatusBar1.Panels(3).Text = " " & Str(Now) & " " //timer事件作用时间内刷新StatusBar1.Panels(3)的文本为当前时间

a = a + 1
If a > 5 Then
a = 1 //定义一个循环的变量,让他在1-5中间循环

End If
Select Case a //case “a”的状态
Case 1, 3, 5 //当a=1或者3或5的时候
StatusBar1.Panels(1).Text = " 欢迎使用公安110接处警系统 版本 V1.0! 此系统有石油大学计算机系制作 " //StatusBar1.Panels(1)的显示该字符串
Case 2, 4 //当a=2或者4的时候
StatusBar1.Panels(1).Text = ""//StatusBar1.Panels(1)显示为空的

End Select

End Sub

简单的说。就是在StatusBar1.Panels(3)控件上面轮流显示不同的字符串
参考技术A Private
Sub
Timer1_Timer()
'timer
Static
ch
As
Integer
'定义ch为integer型
'如果ch的值大于txttold控件里面显示的数值(clnt为将string型转integer型)
If
ch
>
CInt(txtToID.Text)
Then
ch
=
0
Timer1.Enabled
=
False
Exit
Sub
'退出Sub过程
End
If
If
ch
=
0
Then
'如果ch的值等于0
ch
=
CInt(txtFrmID.Text)
'将txttoid控件里面显示的数值赋给ch
Else
'如果ch的值不等于0
ch
=
ch
+
1
'ch的值+1
End
If
'这个应该是bill1里面的一个自定义函数cmdSetSrvCls,参数为0,
ch,
CInt(txtSrvID1.Text)
,具体要看这个自定义函数后才能解释
bill1.cmdSetSrvCls
0,
ch,
CInt(txtSrvID1.Text)
End
Sub
就这样,应该能看懂吧

动态创建timer

Private
  timer:Ttimer;
procedure MyTimerDo(Sender:Tobject);
procedure create ;
  timer:=TtIMER.Create;
  Timer.Enabled:=True;
  timer.Ontimer:=MyTimerDo;
end;

procedure MyTimerDo(Sender:Tob……

以上是关于Private Sub Timer1_Timer()这段代码的意思?的主要内容,如果未能解决你的问题,请参考以下文章

Private Sub、Function 和 Class 的区别

一个Private Sub下的两个对话框功能

如何在工作表上将两个子与 Private Sub Worksheet_Change 合并

VB里的“Private Sub Command1_Click()”是啥意思?

如何在一张工作表上运行 2 个 Private Sub Worksheet_Change?

失踪 ; before 第 1 行 Private Sub Worksheet_SelectionChange(ByVal Target As Range) 的语句