I have a game where I roll a dice, when it finishes it's either: imgdie(0), imgdie(1), imgdie(2), imgdie(3), imgdie(4) or imgdie(5)
how can I say
label1.caption = "[THE INDEX OF THE DIE IT ENDED ON]"
??
thx in advance
Printable View
I have a game where I roll a dice, when it finishes it's either: imgdie(0), imgdie(1), imgdie(2), imgdie(3), imgdie(4) or imgdie(5)
how can I say
label1.caption = "[THE INDEX OF THE DIE IT ENDED ON]"
??
thx in advance
Set the caption of the label at the same time that you choose the die. Post your code for a more detailed response...
r u using an 'ImageList' Component?
Good point!Quote:
Originally posted by seaweed
Set the caption of the label at the same time that you choose the die. Post your code for a more detailed response...
no, I don't need to post my code, you have a good Idea thereQuote:
Originally posted by seaweed
Set the caption of the label at the same time that you choose the die. Post your code for a more detailed response...
thx
finally ... that wouldnt work... here's my code:
VB Code:
Private Sub TmrDé_Timer() Static I As Integer If Toure = 1 Then CmdDéJoueur.Picture = ImgDé(Int(Rnd * 4 + 1)) ElseIf Toure = 2 Then CmdDéPC.Picture = ImgDé(Int(Rnd * 4 + 1)) End If I = I + 1 If I >= 10 Then I = 0 TmrDé.Enabled = False End If End Sub
NM, I figured it out
I don't see where you added any code to set the Label caption. See if this helps:VB Code:
Private Sub TmrDé_Timer() Static I As Integer Dim intRandomNumber As Integer ' Pick a random number intRandomNumber = Int(Rnd * 4 + 1) ' Set the picture property If Toure = 1 Then CmdDéJoueur.Picture = ImgDé(intRandomNumber) ElseIf Toure = 2 Then CmdDéPC.Picture = ImgDé(intRandomNumber) End If ' Set the label caption Label1.Caption = intRandomNumber I = I + 1 If I >= 10 Then I = 0 TmrDé.Enabled = False End If End Sub