Saturday, 31 August 2013

Visual Basic Pause Code

Visual Basic Pause Code

I am currently trying to make a simple slot machine app. I am trying to
make it like a traditional slot machine with the spinner where it goes
through and shows the different pictures. I have been trying to use a
Sleep comand found in many similar posts on here but it keeps crashing my
program. The last coe I tested is below:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label1.Text = CStr(Int(Rnd() * 10)) 'pick numbers
Label2.Text = CStr(Int(Rnd() * 10))
Label3.Text = CStr(Int(Rnd() * 10))
Threading.Thread.Sleep(1000)
Label1.Text = CStr(Int(Rnd() * 10)) 'pick numbers
Label2.Text = CStr(Int(Rnd() * 10))
Label3.Text = CStr(Int(Rnd() * 10))
Threading.Thread.Sleep(1000)
Label1.Text = CStr(Int(Rnd() * 10)) 'pick numbers
Label2.Text = CStr(Int(Rnd() * 10))
Label3.Text = CStr(Int(Rnd() * 10))
Threading.Thread.Sleep(1000)
End Sub
Can anyone make a recommendation of what I need to change? I want it to
pop up a few different numbers and switch between them each second. Thanks
for any help you can provide

No comments:

Post a Comment