VB School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB Expert!

Join 307,096 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,026 people online right now. Registration is fast and FREE... Join Now!




creating a slot machine using random images

 

creating a slot machine using random images

diehard11

4 Nov, 2009 - 04:08 PM
Post #1

New D.I.C Head
*

Joined: 4 Nov, 2009
Posts: 1

can any one see my program and see if works for you
i am trying get this to run right
or do any one have a better code


Private Sub cmdallspin_Click()

Dim pic1 As Integer, pic2 As Integer, pic3 As Integer
Dim payoff As Currency
'pay to win
' Winnings=winnings

'generate random results
pic1 = Int(4 * Rnd + 1)
pic2 = Int(4 * Rnd + 1)
pic3 = Int(4 * Rnd + 1)
'display icons
If pic1 = club Then
imgslot1 = imgclub
ElseIf pic1 = heart Then
imgslot1 = imgheart
ElseIf pic1 = diamond Then
imgslot1 = imgdiamond
ElseIf pic2 = spade Then
imgslot1 = imgspade
End If

'display icon2
If pic2 = club Then
imgslot2.Picture = imgclub
ElseIf pic2 = heart Then
imgslot2.Picture = imgheart
ElseIf pic2 = diamond Then
imgslot2.Picture = imgdiamond
ElseIf pic2 = spade Then
imgslot2.Picture = imgspade
End If

'display icon3
If pic3 = club Then
imgslot3.Picture = imgclub
ElseIf pic3 = heart Then
imgslot3.Picture = imgheart
ElseIf pic3 = diamond Then
imgslot3.Picture = imgdiamond
ElseIf pic3 = spade Then
imgslot3.Picture = imgspade
End If
'check to see if player has won
If pic1 = pic2 And pic2 = pic3 Then
If pic1 = diamomd Then
payoff = 25
msgboxv "You win"
End If
Else
payoff = 0
Beep
End If

'compute and display total winnings
Winnings = Winnings + payoff
'cmdspin2
lbltotal.Caption = Format(Winnings, "0.00")






User is offlineProfile CardPM
+Quote Post


bytelogik

RE: Creating A Slot Machine Using Random Images

4 Nov, 2009 - 10:26 PM
Post #2

D.I.C Head
**

Joined: 6 Oct, 2009
Posts: 63



Thanked: 5 times
My Contributions
What exact errors are you receiving from your code ?
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 11:50AM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month