16,019,133 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Amerigoware (Top 2 by date)
Amerigoware
6-Sep-24 10:35am
View
Deleted
Thank you OriginalGriff. This is what I came up with:
Public Class Form1
#Region "Variables"
Private P1, P2, P3 As Integer
Private R1, R2, R3 As Integer
Private Rand As New Random
Private SW1, SW2, SW3 As New Stopwatch
Private Cash As Integer = 100
Private Chance As Integer
#End Region
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ImageList1.Images.Add(My.Resources.Penny)
ImageList1.Images.Add(My.Resources.Nickle)
ImageList1.Images.Add(My.Resources.Dime)
ImageList1.Images.Add(My.Resources.Quarter)
ImageList1.Images.Add(My.Resources.Half_Dollar)
ImageList1.Images.Add(My.Resources.Dollar)
P1 = Rand.Next(0, 6)
P2 = Rand.Next(0, 6)
P3 = Rand.Next(0, 6)
PictureBox1.Image = ImageList1.Images(P1)
PictureBox2.Image = ImageList1.Images(P2)
PictureBox3.Image = ImageList1.Images(P3)
ScoreLbl.Text = "$" & Cash.ToString
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Label1.Text = ""
Cash -= 1
ScoreLbl.Text = "$" & Cash.ToString
Chance = Rand.Next(0, 101)
R1 = Rand.Next(1500, 2000)
R2 = Rand.Next(2000, 2500)
R3 = Rand.Next(2500, 3000)
Timer1.Interval = 100
Timer1.Start()
Timer2.Interval = 100
Timer2.Start()
Timer3.Interval = 100
Timer3.Start()
Timer4.Start()
SW1.Start()
SW2.Start()
SW3.Start()
Button1.Enabled = False
End Sub
#Region "Timers"
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
P1 += 1
If P1 > 5 Then
P1 = 0
End If
PictureBox1.Image = ImageList1.Images(P1)
PictureBox1.Image.Tag = P1
Timer1.Interval += 10
If SW1.ElapsedMilliseconds >= R1 Then
SW1.Stop()
SW1.Reset()
Timer1.Stop()
End If
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
P2 += 1
If P2 > 5 Then
P2 = 0
End If
PictureBox2.Image = ImageList1.Images(P2)
PictureBox2.Image.Tag = P2
Timer2.Interval += 10
If SW2.ElapsedMilliseconds >= R2 Then
If P2 = P1 Then
'Chance = Rand.Next(0, 101)
Select Case P1
Case 0
Allow2()
Case 1
If Chance < 80 Then
Allow2()
Else
R2 += 100
Exit Select
End If
Case 2
If Chance < 60 Then
Allow2()
Else
R2 += 100
Exit Select
End If
Case 3
If Chance < 40 Then
Allow2()
Else
R2 += 100
Exit Select
End If
Case 4
If Chance < 20 Then
Allow2()
Else
R2 += 100
Exit Select
End If
Case 5
If Chance < 10 Then
Allow2()
Else
R2 += 100
Exit Select
End If
End Select
Else
Allow2()
End If
End If
Amerigoware
30-Dec-22 9:03am
View
Thanks for the suggestion. I will try that. I suspect I will have to clear the temp folder on the next start up though, but that's okay.