Couldn't resist to quickly put somethig together, but I would assume there are much more sophisticated program around. At least you have a starting point here.
Add a command1, command2 button and a text1 field to your form, and paste the code below in yor program code and bingo! :-))
I would extend the program to show on screen all numbers drawn sofar, etc...
- Option Explicit
-
Const MAX As Integer = 80'set max nr, change to whatever the game requires
-
Dim iNrs(1 To MAX) As Boolean'assume first number = 1
-
Dim iCnt As Integer
-
-
Private Sub Command1_Click() 'clear, start fresh
-
Dim i As Integer
-
For i = 1 To MAX
-
iNrs(i) = False
-
Next i
-
iCnt = 0
-
End Sub
-
-
Private Sub Command2_Click()'draw a number
-
Dim iNr As Integer
-
If iCnt < MAX Then
-
Do
-
iNr = Int((MAX * Rnd) + 1)'generate nr between 1 and MAX
-
Loop Until Not iNrs(iNr)
-
iCnt = iCnt + 1
-
iNrs(iNr) = True
-
Text1.Text = iNr
-
Else
-
Call MsgBox("All numbers done", vbInformation, "done")
-
End If
-
End Sub
-
-
Private Sub Form_Load()
-
Randomize
-
End Sub
-