高手请指教,利用timer控件如何实现定时?列如想让下列程序运行3分钟,该家什么代码?
Private Sub Timer1_Timer()m = 0
For i = 1 To 10000
x = Rnd
y = Rnd
If x ^ 2 + y ^ 2 < 1 Then
m = m + 1
End If
Next i
p = 4 * m / 10000
n = (m / 10000) - (m / 10000) ^ 2
Text1.Text = Text1.Text & p & vbCrLf
Text2.Text = Text2.Text & n & vbCrLf
Open "c:\131.txt" For Output As #1
Print #1, Text1.Text
Close #1
Open "c:\132.txt" For Output As #2
Print #2, Text2.Text
Close #2
End Sub