DolfinCry
Messages postés25Date d'inscriptionlundi 14 janvier 2002StatutMembreDernière intervention 7 octobre 2002 17 janv. 2002 à 23:47
Si tu veux mais moi, je voulais un effet d'attente, comme une vrai machine a boule, ce que j'ai pas avec le tien mais je crois que si on rajoute des DoEvents, on pourrais avoir l'effet rechercher
cs_khalilo
Messages postés71Date d'inscriptionjeudi 17 janvier 2002StatutMembreDernière intervention12 mai 2004 17 janv. 2002 à 12:49
Ton prog est pas mal mais je amélioré le code:
Private Sub cmdstart_Click()
Dim intQte As Single
Dim nb(3)
lblgains2.Visible = False
lblgains.Visible = False
lblgains2.Caption = ""
lblgains.Caption = ""
Randomize 'random pour le défilement des nombres
nb(0) = Int(Rnd * 10)
nb(1) = Int(Rnd * 10)
nb(2) = Int(Rnd * 10)
nb(3) = Int(Rnd * 10)
For i = 0 To 3
For n = 0 To nb(i)
lbl7(i).Caption = n
For j = 0 To 200
DoEvents
DoEvents
DoEvents
DoEvents
DoEvents
Next
Next
Next
'Calcul du nombre de 7
intQte = 0
For i = 0 To 3
If lbl7(i).Caption = 7 Then
intQte = intQte + 1
End If
Next
'Affichage du montant gagné
If intQte = 4 Then
lblgains.Caption = Format(Val(lblgains.Caption) + 500, "currency")
lblgains.Visible = True
ElseIf intQte = 3 Then
lblgains.Caption = Format(Val(lblgains.Caption) + 100, "currency")
lblgains.Visible = True
ElseIf intQte = 2 Then
lblgains.Caption = Format(Val(lblgains.Caption) + 10, "currency")
lblgains.Visible = True
ElseIf intQte = 1 Then
lblgains.Caption = Format(Val(lblgains.Caption) + 2, "currency")
lblgains.Visible = True
Else
lblgains2.Caption = "Vous n'avez rien gagné..."
lblgains2.Visible = True
End If
'Si vous n'avez plus d'argent, vous devez remiser ou partir
If lblsolde.Caption <= 0 Then
MsgBox "VOUS N'AVEZ PLUS D'ARGENT, LA BANQUE CONTINUE SON BON TRAVAIL", vbCritical, "Banqueroute"
choix = MsgBox("Voulez vous remiser?", vbYesNo, "Remiser?")
If choix = vbNo Then
End
Else
txtmise.Enabled = True
txtmise.Text = ""
txtmise_gotfocus
End If
End If
End Sub
DolfinCry
Messages postés25Date d'inscriptionlundi 14 janvier 2002StatutMembreDernière intervention 7 octobre 2002 17 janv. 2002 à 02:20
il vous faudrais toujours changer de nom
Ex:. a1
a2
a3...
17 janv. 2002 à 23:47
17 janv. 2002 à 12:49
Private Sub cmdstart_Click()
Dim intQte As Single
Dim nb(3)
lblgains2.Visible = False
lblgains.Visible = False
lblgains2.Caption = ""
lblgains.Caption = ""
Randomize 'random pour le défilement des nombres
nb(0) = Int(Rnd * 10)
nb(1) = Int(Rnd * 10)
nb(2) = Int(Rnd * 10)
nb(3) = Int(Rnd * 10)
For i = 0 To 3
For n = 0 To nb(i)
lbl7(i).Caption = n
For j = 0 To 200
DoEvents
DoEvents
DoEvents
DoEvents
DoEvents
Next
Next
Next
'Calcul du nombre de 7
intQte = 0
For i = 0 To 3
If lbl7(i).Caption = 7 Then
intQte = intQte + 1
End If
Next
'Affichage du montant gagné
If intQte = 4 Then
lblgains.Caption = Format(Val(lblgains.Caption) + 500, "currency")
lblgains.Visible = True
ElseIf intQte = 3 Then
lblgains.Caption = Format(Val(lblgains.Caption) + 100, "currency")
lblgains.Visible = True
ElseIf intQte = 2 Then
lblgains.Caption = Format(Val(lblgains.Caption) + 10, "currency")
lblgains.Visible = True
ElseIf intQte = 1 Then
lblgains.Caption = Format(Val(lblgains.Caption) + 2, "currency")
lblgains.Visible = True
Else
lblgains2.Caption = "Vous n'avez rien gagné..."
lblgains2.Visible = True
End If
'Diminution de 2$ a chaque partie
lblsolde.Caption = Val(lblsolde.Caption) - 2
lblsolde.Caption = Val(lblsolde.Caption) + Val(lblgains.Caption)
lblsolde.Caption = Format(lblsolde.Caption, "currency")
'Si vous n'avez plus d'argent, vous devez remiser ou partir
If lblsolde.Caption <= 0 Then
MsgBox "VOUS N'AVEZ PLUS D'ARGENT, LA BANQUE CONTINUE SON BON TRAVAIL", vbCritical, "Banqueroute"
choix = MsgBox("Voulez vous remiser?", vbYesNo, "Remiser?")
If choix = vbNo Then
End
Else
txtmise.Enabled = True
txtmise.Text = ""
txtmise_gotfocus
End If
End If
End Sub
17 janv. 2002 à 02:20
Ex:. a1
a2
a3...