•
•
•
•
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
![]() |
•
•
Join Date: Dec 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
![]() |
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- C++ Random Numbers (C++)
- Random Number Problem For Lottery Program (Visual Basic 4 / 5 / 6)
- lottery program help (Java)
- Help with Java programming for lottery (Java)
- please help me this program. i want the source code (Java)
- Lottery Program (Java)
Other Threads in the VB.NET Forum
- Previous Thread: Accepting certain key inputs
- Next Thread: Printing HTML from VB.Net


Linear Mode