Traffic lights in vb6 resolved
time2change
Messages postés
60
Statut
Membre
-
time2change Messages postés 60 Statut Membre -
time2change Messages postés 60 Statut Membre -
hi. i'm tryin to make a traffic lights in vb6, but my code is not workin, plz i need some help to know my mistakes.
i have 3 timers, 1 commandbutton, 3 shapes with the 3 colors(red, yellow & green).
this is my code:
Private Sub Command1_Click()
If Command1 = True Then
Shape1.Visible = True
Timer1.Enabled = True
End If
End Sub
Private Sub Timer1_Timer()
If Interval = 0 Then
Shape1.Visible = False
Timer2.Enabled = True
Shape2.Visible = True
End If
End Sub
Private Sub Timer2_Timer()
If Interval = 0 Then
Shape2.Visible = False
Timer3.Enabled = True
Shape3.Visible = True
End If
End Sub
Private Sub Timer3_Timer()
If Interval = 0 Then
Shape3.Visible = False
Timer1.Enabled = True
Shape1.Visible = True
End If
End Sub
merci d'avance.
i have 3 timers, 1 commandbutton, 3 shapes with the 3 colors(red, yellow & green).
this is my code:
Private Sub Command1_Click()
If Command1 = True Then
Shape1.Visible = True
Timer1.Enabled = True
End If
End Sub
Private Sub Timer1_Timer()
If Interval = 0 Then
Shape1.Visible = False
Timer2.Enabled = True
Shape2.Visible = True
End If
End Sub
Private Sub Timer2_Timer()
If Interval = 0 Then
Shape2.Visible = False
Timer3.Enabled = True
Shape3.Visible = True
End If
End Sub
Private Sub Timer3_Timer()
If Interval = 0 Then
Shape3.Visible = False
Timer1.Enabled = True
Shape1.Visible = True
End If
End Sub
merci d'avance.
10 réponses
-
Hi,
I'm not sure that it's what you want:
Private Sub Command1_Click() Shape1.Visible = False Timer1.Enabled = True End Sub Private Sub Form_Load() Timer1.Interval = 1000 Timer2.Interval = 1000 Timer3.Interval = 1000 Shape1.Visible = False Shape2.Visible = False Shape3.Visible = False End Sub Private Sub Timer1_Timer() Shape1.Visible = True Shape3.Visible = False Timer2.Enabled = True Shape2.Visible = False Timer1.Enabled = False End Sub Private Sub Timer2_Timer() Shape2.Visible = True Shape1.Visible = False Timer3.Enabled = True Shape3.Visible = False Timer2.Enabled = False End Sub Private Sub Timer3_Timer() Shape3.Visible = True Shape2.Visible = False Timer1.Enabled = True Shape1.Visible = False Timer3.Enabled = False End Sub
;o) -
tht's exactly wht i tried few minuts ago.
thx for the answer. -
ps: enabled=false for all the timers & visible=false for all the shapes.
Private Sub Command1_Click()
If Command1 = True Then
Shape1.Visible = True
Timer1.Enabled = True
End If
End Sub
Private Sub Timer1_Timer()
If Interval = 0 Then
Timer1.Enabled = False
Shape1.Visible = False
Shape3.Visible = False
Timer2.Enabled = True
Shape2.Visible = True
End If
End Sub
Private Sub Timer2_Timer()
If Interval = 0 Then
Timer2.Enabled = False
Shape1.Visible = False
Shape2.Visible = False
Timer3.Enabled = True
Shape3.Visible = True
End If
End Sub
Private Sub Timer3_Timer()
If Interval = 0 Then
Timer3.Enabled = False
Shape3.Visible = False
Shape2.Visible = False
Timer1.Enabled = True
Shape1.Visible = True
End If
End Sub -
The interval specifies the frequency of excécution a code. For one second > Interval = 1000. For 5 seconds> Interval = 5000 ...
If the interval is zero, nothing happens
-
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question -
yeah ur right.
i wanted to regist my work as .exe but this option is disactivated cuz i only have vb portable. any suggestions ?? -
i'm sorry but compiled to wht?? i have no idea wht ur talkin abt, i told u i just started vb6 so i rono wht i suppose to do to creat .exe
-
Please don't use abbreviations. I don't understand everything you write. My English is not very good. I'm sorry.
It must first save the project before making an exe. -
sorry i didn't know.
i said that i'm not that good with vb6, so i dont know how to creat .exe
tell me what i should do to make it .exe plz, because i never tried it before ?? -
I have a French version of VB6. It must first save the file and after creating the Excecutive.
I do like that:
Menu> File> Create Projet1.exe
-
ok merci, mé le prob c ke g seulement un vb portable, é l'option projet1.exe é désactivée. de toute façon j v éssayer de telecharger vb6 complet car j l'avais just trouvé. merci encore de ton aide.