Besoin d'aide pour une génération aléatoire

Résolu
red tiger Messages postés 4 Date d'inscription samedi 16 décembre 2006 Statut Membre Dernière intervention 17 décembre 2006 - 16 déc. 2006 à 11:56
red tiger Messages postés 4 Date d'inscription samedi 16 décembre 2006 Statut Membre Dernière intervention 17 décembre 2006 - 16 déc. 2006 à 12:09
Bonjour, j'aimerai avoir une solution pour pouvoir générer aléatoirement un nombre entre 1 et 8

mon code a présent est le suivant:

Private Sub Command17_Click()
Randomize Timer
Command1(0).Caption = Int(Rnd) * 8
Command2.Caption = Int(Rnd) * 8
Command3.Caption = Int(Rnd) * 8
Command4.Caption = Int(Rnd) * 8
Command5.Caption = Int(Rnd) * 8
Command6.Caption = Int(Rnd) * 8
Command7.Caption = Int(Rnd) * 8
Command8.Caption = Int(Rnd) * 8
Command9.Caption = Int(Rnd) * 8
Command10.Caption = Int(Rnd) * 8
Command11.Caption = Int(Rnd) * 8
Command12.Caption = Int(Rnd) * 8
Command13.Caption = Int(Rnd) * 8
Command14.Caption = Int(Rnd) * 8
Command15.Caption = Int(Rnd) * 8
Command16.Caption = Int(Rnd) * 8
End Sub

le problème ici est que le nombre qu'il me donne partout est "0"

2 réponses

sternistern Messages postés 9 Date d'inscription samedi 12 juin 2004 Statut Membre Dernière intervention 3 mai 2007
16 déc. 2006 à 12:07
Salut.
Essai comme ça.

Private Sub Command17_Click()
Randomize Timer
Command1(0).Caption = Int(Rnd * 8)

End Sub

Stern
3
red tiger Messages postés 4 Date d'inscription samedi 16 décembre 2006 Statut Membre Dernière intervention 17 décembre 2006
16 déc. 2006 à 12:09
merci, c'étai bien ça.
bonne journée et encore merci.
0
Rejoignez-nous