vb 点击command产生小于20的随机数,使其中的奇数出现在list1中,偶数出现在list2中,运用timer间隔1秒
1个回答
展开全部
Dim timers As Integer
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim n As Integer
times = times + 1
If times = 20 Then
times = 0
Timer1.Enabled = False
End If
Randomize
n = Int(Rnd * 20)
If n Mod 2 = 0 Then
List1.AddItem n
Else
List2.AddItem n
End If
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim n As Integer
times = times + 1
If times = 20 Then
times = 0
Timer1.Enabled = False
End If
Randomize
n = Int(Rnd * 20)
If n Mod 2 = 0 Then
List1.AddItem n
Else
List2.AddItem n
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询