如何用VB编写一个简单的选号器?就是点击然后程序随机帮选出一个数(1~70个数)
双色球随机选:
Private Sub Command1_Click()
Dim a(6) As Integer
Dim b As Integer
For i = 1 To 6
a(i) = Int(Rnd() * (1 + (33 - 1))) + 1
For j = 1 To i - 1
If a(i) = a(j) Then
i = i - 1
End If
Next
Next
For i = 1 To 6
For j = i + 1 To 6
If a(i) < a(j) Then
T = a(i): a(i) = a(j): a(j) = T
End If
Next
Next
b = Int(Rnd() * (1 + (16 - 1))) + 1
Text1.Text = a(6) & " " & a(5) & " " & a(4) _
& " " & a(3) & " " & a(2) & " " & a(1) & " +" & b
End Sub