Hello, I'm a 2nd year Computer Engineering student and I have a problem with my VB6 code. I've just started learning VB6 for a project in which we have to create a form which displays the knight-rider light sequence. Obviously, this means using a loop and our lecturer has told us to use timers to control how long the sequence lasts for. I don't want to use timers ((this is not due to laziness, I would have been finished long ago had I used timers!! I just want to see if there is another way to do this project) , and I've read everywhere that the only way to break out of an infinite loop is Ctl+Alt+Del! What I am asking is - is there any code I could use to over-write the loop which I could also link with a command button (i.e. when I hit my 'exit' button on my form, the program stops runnning). If this is not possible, a way in which the user could input a number which would stop the program would also be a great help. The module I'm studying this for is interfacing, so user-compatability is paramount. Perhaps there is a different loop I could use which offers more flexibility?
Here is an outline of my code so far:
Private Sub cmdstart_click( )
Dim Index As Integer
Do While x < 50 (There's no particular reason why I chose 50, I just wanted to create an infinite loop)
For x = 0 To 7
DoEvents
Next x
For x = 6 To 0 Step -1
Do Events
Next x
Loop
End Sub
Code for 'Exit' Button
Private Sub Command1_Click( )
Unload Me
End Sub
I haven't posted the 'events' in the code, as the posting guidlines advise that you shouldn't post all of your code. I need to have this done in two days, so any help is appreciated! Thanks in advance, Anna.
Here is an outline of my code so far:
Private Sub cmdstart_click( )
Dim Index As Integer
Do While x < 50 (There's no particular reason why I chose 50, I just wanted to create an infinite loop)
For x = 0 To 7
DoEvents
Next x
For x = 6 To 0 Step -1
Do Events
Next x
Loop
End Sub
Code for 'Exit' Button
Private Sub Command1_Click( )
Unload Me
End Sub
I haven't posted the 'events' in the code, as the posting guidlines advise that you shouldn't post all of your code. I need to have this done in two days, so any help is appreciated! Thanks in advance, Anna.
Comment