Results 1 to 5 of 5

Thread: Is there a substitute for the While.. Doevents.. Wend cycle?

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    Singapore
    Posts
    32

    Post

    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.

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

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088

    Post

    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
    [email protected]
    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).]

  3. #3
    Guest

    Post

    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

  4. #4
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386

    Post

    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

  5. #5
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088

    Post

    Yes, CrazyD, that's exactly what I wrote

    ------------------
    Fox
    [email protected]
    http://gigotz.tsx.org
    ...
    Every program can be reduced to one instruction which doesn't work.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width