Results 1 to 6 of 6

Thread: Abort all processes and unload form

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    Question Abort all processes and unload form

    I had 5 process procedures in a form, they are:

    process1
    process2
    process3
    process4
    process5

    I also have a "Exit" button

    when processing is in progress, how to abort all processes then unload the form when user click "exit" button

    please advise
    thanks and regards
    Winanjaya

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Abort all processes and unload form

    Is there looping going on in your proceeses?

    If so, then you can set a Boolean flag that it would check each time through the loop. If the Flag is set to True, then you can issue an Unload Me terminate your application.

    If there is no looping going on, then the only place you would be able to accomplish your goal is right when one process stops and just before another one begins, but you would not be able to interrupt one of the processes once it got started.

  3. #3
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Abort all processes and unload form

    Does VB6 still use the END keyword? I think VB3 had it... It basically just exits out of everything.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  4. #4
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Abort all processes and unload form

    From my MSDN CD:

    Remarks

    When executed, the End statement resets allmodule-level variables and all static local variables in allmodules. To preserve the value of these variables, use the Stop statement instead. You can then resume execution while preserving the value of those variables.

    Note The End statement stops code execution abruptly, without invoking the Unload, QueryUnload, or Terminate event, or any other Visual Basic code. Code you have placed in the Unload, QueryUnload, and Terminate events offorms andclass modules is not executed. Objects created from class modules are destroyed, files opened using the Open statement are closed, and memory used by your program is freed. Object references held by other programs are invalidated.

    The End statement provides a way to force your program to halt. For normal termination of a Visual Basic program, you should unload all forms. Your program closes as soon as there are no other programs holding references to objects created from your public class modules and no code executing.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Abort all processes and unload form

    It's not a good idea to use END. It has been discussed many times on the forum.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Abort all processes and unload form

    And, even if you were to employ a bad idea and use End, you still would have to wait until the existing process finished. Unless the process is looping, there isn't any way to stop it short of using Task Manage to shut your application down.

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