这个问题我刚解决了,我用了一种最笨的办法,就是把数的范围存入一个list中,在窗体上建了两个list,几个label,还有一个timer,两个Command
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
'List1.RemoveItem Label1.Caption
'List2.AddItem Label1.Caption
For j = 0 To List1.ListCount - 1
If List1.List(j) = Label1.Caption Then
List2.AddItem Label1.Caption, 0
List1.RemoveItem j
Exit Sub
End If
Next j
End Sub
Private Sub Form_Load()
For i = 0 To 38
List1.List(i) = Format(i + 1, "00")
Next i
End Sub
Private Sub Timer1_Timer()
Label1.Caption = List1.List(Rnd * (List1.ListCount - 1))
End Sub
'我在VB6.0中一般是这样处理的
St!=Timer
for i=0 to St!
Rnd
next i
Randomize()
For i = 1 To n
ret=0
numDl(i) = Int(48 * Rnd() + 1)
for a=1 to i
if numDl(i)=numDl(a) then
ret=1
exit for
else
ret=0
end if
next
loop while ret=1
Console.Write("{0} ", numDl(i))
Next i
Randomize(Timer)