Simulate a traffic light with a control array consisting of three small square picture boxes placed vertically on a form. initially the bottom picture box is solid green and the other picture boxes are white. when the tab key is pressed, the middle picture box turns yellow and the bottom picture box turns white. the next time tab is pressed, the top picture box turns red and the middle picture box turns white. subsequent pressing of the tab key cycles through the three colors. Hint: First, place the bottom picture box on the form then the middle picture box and finally the top picture box.
Private Sub Form_KeyPress(vbkeytab As Integer) If tabindex = 1 Then Picture2.BackColor = vbYellow Picture1.BackColor = vbWhite ElseIf tabindex = 2 Then Picture3.BackColor = vbRed Picture2.BackColor = vbWhite Picture1.BackColor = vbWhite End If End Sub
please help me... I don't know why its not working.... :"( what should i use to make it work? a vbkeytab or tabindex? is tabindex really needed? do i need to make it a control array? how??? PLEASE HELP...

New Topic/Question
Reply




MultiQuote




|