Private 老陆纤Sub Command1_Click()
Dim team(8), teamA(4), teamB(4) As String, i%, j%
team(1) = "中国"
team(2) = "美国"
team(3) = "巴西"
team(4) = "古巴"
team(5) = "俄罗斯"悉局
team(6) = "荷兰"
team(7) = "德国"
team(8) = "西班牙"
For i = 1 To 8
x = Int((9 - i) * Rnd + 1) '剩余随机选择
If i > 4 Then
teamA(i - 4) = team(x)
Else
teamB(i) = team(x)
End If
For j = x To 8
If 侍仿j < 8 Then team(j) = team(j + 1)
Next
Next
Text1.Text = teamA(1) & Space(2) & teamA(2) & Space(2) & teamA(3) & Space(2) & teamA(4)
Text2.Text = teamB(1) & Space(2) & teamB(2) & Space(2) & teamB(3) & Space(2) & teamB(4)
End Sub
首先,加一个timer控件,肆蚂来一个全局变量x=0timer的事件就是让那个4显示一个随晌雹侍机数,然后x自加,等x=51的时候,宴吵timer1.enable=false,然后执行1-51随机数的函数
你们班有51个人?
Private Sub Command1_Click() '点开始Timer1.Interval = 高局100
Timer1.Enabled = True
End Sub
Private Sub Command2_Click() '点结束
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer() '抽签过程
Dim m()
Randomize
m = Array("张三", "李四", "阿猫", "阿狗", "这里放上滚念轮全部65个名字…大信…")
Label1.Caption = m(Int(Rnd * (UBound(m) + 1)))
End Sub
上述程序用到四个控件:Command1、Command2、Label1、Timer1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)