Hello,
I am using the following approach to do some simple animation inside a picture box:

Code:
Dim bFlag as Boolean

Private Sub StartAnimation()
    bFlag = True
    Do While bFlag
        'Do Animation
        DoEvents
        Sleep 10 'update every 10 milliseconds
    Loop
End Sub

Private Sub StopAnimation()
    bFlag = False
End Sub
Now when i unload my form while the animation is on, i try to call the StopAnimation function, but that doesn't stop the animation, and my app is left hanging (it doesnt unload, but rather becomes invisible or something). In IDE mode, i have to press the "Stop" button. When compiled, the program can still be found in the apps list and the processes list of the task manager after i exit it while the animation loop is running.

I am seeking some suggestions on how to deal with this matter WITHOUT RECURRING TO USING TIMERS FOR MY ANIMATION LOOP.

Thank you.