1pal4u 0 Newbie Poster

Just starting to program, 1st assignment was to create lottery interface for randomize numbers 1- 54. displays 6 lottery numbers separate label control, Print button printing w/o command buttons showing, and an exit button. So far this is what I've done for coding what am I missing or doing wrong?

Private Sub RandomNumbers()
Dim intTemp As Integer
Randomize 'generate random numbers
intNum1 = Int((54 - 1 + 1) * Rnd + 1)
intNum2 = Int((54 - 1 + 1) * Rnd + 1)
intNum3 = Int((54 - 1 + 1) * Rnd + 1)
intNum4 = Int((54 - 1 + 1) * Rnd + 1)
intNum5 = Int((54 - 1 + 1) * Rnd + 1)
intNum6 = Int((54 - 1 + 1) * Rnd + 1)
End Sub

Private Sub Command1_Click()
Randomize

Label1.Caption = Str(Int(Rnd * 54) + 1)
Label2.Caption = Str(Int(Rnd * 54) + 1)
Label3.Caption = Str(Int(Rnd * 54) + 1)
Label4.Caption = Str(Int(Rnd * 54) + 1)
Label5.Caption = Str(Int(Rnd * 54) + 1)
Label6.Caption = Str(Int(Rnd * 54) + 1)

If (Label1 = Label2) Or (Label1 = Label3) Or (Label1 = Label4) Or (Label1 = Label5) Or (Label1 = Label6) Then Label1.Caption = Str(Int(Rnd * 54) + 1)
End If
If (Label2 = Label1) Or (Label2 = Label3) Or (Label2 = Label4) Or (Label2 = Label5) Or (Label2 = Label6) Then Label2.Caption = Str(Int(Rnd * 54) + 1)
End If
If (Label3 = Label1) Or (Label3 = Label2) Or (Label1 = Label4) Or (Label3 = Label5) Or (Label3 = Label6) Then Label3.Caption = Str(Int(Rnd * 54) + 1)
End If
If (Label4 = Label1) Or (Label4 = Label2) Or (Label1 = Label3) Or (Label4 = Label5) Or (Label4 = Label6) Then Label4.Caption = Str(Int(Rnd * 54) + 1)
End If
If (Label5 = Label1) Or (Label5 = Label2) Or (Label1 = Label3) Or (Label5 = Label4) Or (Label5 = Label6) Then Label5.Caption = Str(Int(Rnd * 54) + 1)
End If
If (Label6 = Label1) Or (Label6 = Label2) Or (Label1 = Label3) Or (Label6 = Label4) Or (Label6 = Label5) Then Label6.Caption = Str(Int(Rnd * 54) + 1)
End If
End Sub


End Sub

Private Sub Form_Load()

End Sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.