User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 455,988 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,790 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 1754 | Replies: 0
Reply
Join Date: Dec 2007
Posts: 2
Reputation: 1pal4u is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
1pal4u 1pal4u is offline Offline
Newbie Poster

Help Lottery Program for VB

  #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
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 9:31 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC