2008-01-03 09:07:50耶 ♥
加入計時器取亂數
Public Class Form1
Dim count As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
count = 0
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim s As Single
Dim i As Integer
If count = 20 Then
Timer1.Enabled = False
Else
VBMath.Randomize()
s = VBMath.Rnd
i = Int(s * 45) + 1
Label2.Text = i
count = count + 1
End If
End Sub
End Class
Dim count As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
count = 0
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim s As Single
Dim i As Integer
If count = 20 Then
Timer1.Enabled = False
Else
VBMath.Randomize()
s = VBMath.Rnd
i = Int(s * 45) + 1
Label2.Text = i
count = count + 1
End If
End Sub
End Class