Private Sub Command1_Click()
Form_Load
End Sub
Private Sub Form_Load()
Dim a(1 To 10) As Integer
Randomize
p= "" 'p用来显示随机生成的10个整数
For i = 1 To 10
Do
X = Int(Rnd * 90) + 10 '存放中间生成一个随机整数
yes = 0 '用来判断生成的数要还是不要,0表示要,1表示不要
For j = 1 To i - 1 '对生成的第一个随机整数进行检测
If X = a(j) Then yes = 1: Exit For '防止出现重复的数
Next
Loop While yes = 1
a(i) = X
p= p & Str(a(i)) & ","
Next
Label1.Caption = LTrim(Left(p, Len(p) - 1))
End Sub