PDA

Click to See Complete Forum and Search --> : Is there a substitute for the While.. Doevents.. Wend cycle?


Athenis
Jan 10th, 2000, 09:43 PM
The Doevents thing is preventing my form from unloading.
Is there a way to unload a form nicely while a While/Doevents/Wend loop is running, or is there a better substitute altogether?
Thanks.

------------------

Fox
Jan 10th, 2000, 09:51 PM
Try to do it like this:

-

Public Sub Main()
Dim Active as Boolean

Active = true
While Active
'Code here

DoEvents
Wend
End Sub

-

Just call Main after starting the program and if you want to exit set Active to False.


------------------
Fox
gigotz@gmx.net
http://gigotz.tsx.org
...
Every program can be reduced to one instruction which doesn't work.



[This message has been edited by Fox (edited 01-11-2000).]

Jan 10th, 2000, 09:57 PM
I hope this will work. didnt tested yet..

Private Sub Command1_Click()

dim i as integer

while not i = 1000
i = i + 1
call unloadform()
doevents
wend

end sub

private function unloadform()

unload form

end function

Crazy D
Jan 10th, 2000, 10:56 PM
Use a boolean, set to true in the form unload, and check in the loop if the bool is true, if so, exit the loop

Fox
Jan 11th, 2000, 04:25 AM
Yes, CrazyD, that's exactly what I wrote ;)

------------------
Fox
gigotz@gmx.net
http://gigotz.tsx.org
...
Every program can be reduced to one instruction which doesn't work.