vb6编写自动刷新网页的程序代码
每三秒刷新一次,模仿自动刷新网页
Option Explicit
'第一种方法:
'Dim I As Integer
'Private Sub Form_Load()
' Timer1.Interval = 3000
'End Sub
'Private Sub Timer1_Timer()
' I = I + 1
' Form1.Label1.Refresh
' Form1.Label1.Caption = "本窗口刷新了" & I & "次"
'End Sub
'三的倍数
'能被三整除的数
'第二种方法:
Dim bux As Integer, Xh As Integer, I As Integer, X As Integer
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
bux = bux + 1
For Xh = 1 To 60
Me.Caption = Second(Time)
If bux / Xh = 3 Then
Form1.Label1.Refresh
Form1.Label1.Caption = "本窗口刷新了" & I & "次"
I = I + 1
End If
Next
End Sub
===================================================
第三种方法:
Option Explicit
Dim bux As Integer, Xh As Integer, I As Integer, X As Integer
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
bux = (bux + 1) Mod 3
Me.Caption = Second(Time)
If bux = 0 Then
Form1.Label1.Refresh
Form1.Label1.Caption = "本窗口刷新了" & I & "次"
I = I + 1
End If
End Sub