CodePudding user response:
Option Explicit
Private Sub Command1_Click ()
Dim aryResult (9) As Long
Dim aryCount As Long
Dim lngTmp As Long
Dim blnExists As Boolean
Dim As Integer I
Do
LngTmp=100 + Rnd (Now ()) * 900 'random three digits
If lngTmp/3 & lt;> LngTmp \ 3 And lngTmp/5 & lt;> 5 Then lngTmp \ 'neither for the divided exactly by 3 or divided exactly by 5
BlnExists=False
For I=LBound (aryResult) To UBound (aryResult) 'the answer To determine whether there have been a
If aryResult (I)=lngTmp Then
BlnExists=True
End the If
Next
If Not blnExists Then 'If Not repeat results Then document the results
AryResult (aryCount)=lngTmp
AryCount=aryCount + 1
End the If
End the If
Loop While aryCount & lt; When the result is 10 out of 10 '
For I=LBound (aryResult) To UBound (aryResult) 'output
The Debug. Print aryResult (I)
Next
End Sub
CodePudding user response:
Bosses, I according to this I can't, couldn't have been lostCodePudding user response:
The code is as follows:
Option Explicit
Private Sub Form_Load ()
Dim colNumbers As New Collection
Dim As Integer I
For I=100 To 999
If I Mod 3=0 And I Mod 5 & lt;> 0 Then
ColNumbers. Add the I
End the If
Next
For I=1 To 10
Randomize
Dim j As Integer
J=Int (Rnd * colNumbers. Count) + 1
The Debug. Print colNumbers (j)
ColNumbers. Remove j
Next
End Sub
Run the example:
Download address:
Link: https://pan.baidu.com/s/1lkvgL7tx0xu3gAMg5bhcAA
The extracted code: hvid
CodePudding user response:
VB6.0 by use is too backward? Or I can'tCodePudding user response:
Immediate window without the data?CodePudding user response:
Where did you lose the code? Is the main form of input?CodePudding user response: