Private Sub Command2_Click()
Const n=12
Dim a(1 To n) As Integer, s As Integer
Dim i As Integer, j As Integer
Randomize
For i=1 To n
a(i)=Int(Rnd * 50)+1
For j=1 To i- 1
If a(i)=a(j) Then
Next j
If j <i Then
Next i
For i=1 To n
For j=1 To n
If Then
s=s+1
List1. AddItem Str(s)+":"+ Str(a(i)) + Str(a(j))
Exit For跳出内层循环
End If
Next j
Next i
End Sub