Lottery Program for VB

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2007
Posts: 2
Reputation: 1pal4u is an unknown quantity at this point 
Solved Threads: 0
1pal4u 1pal4u is offline Offline
Newbie Poster

Lottery Program for VB

 
0
  #1
Dec 4th, 2007
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC