Results 1 to 12 of 12

Thread: [RESOLVED] Wait for process to finish BUT keep VB app running as normal?

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2007
    Posts
    159

    Resolved [RESOLVED] Wait for process to finish BUT keep VB app running as normal?

    I am creating a batch processing interface for a program that doesn't currently support batch processing.

    The user clicks on a form button to trigger the batch processing. When they click on the button, obvioulsy this calls the subroutine mybutton_click()

    Within the subroutine, my code to start the external app is:-

    Code:
    Dim myProcess As Process = System.Diagnostics.Process.Start(myProgram, myProgramParams)
    because 'myProcess' contains the name of the running process, I can create a loop within the subroutine to check if the process is running (using Process.GetProcessByName), and if it is, wait for it to complete before starting the next batch entry.

    However, this method means that my program has to continuosly loop within the subroutine until the external process is no longer running and no more batch entries exist before End Sub is reached.

    What I really need to do is this:-

    1) Process the first entry in the batch but wait until the process completes before starting the next batch entry - I don't want any more than one instance of the external program running at any one time.

    2) While any batch entry is running, I want control to return to my program so that the user can do other things - but obviously, when the external process is complete, I need my program to start the next batch entry if there is one...

    How could I go about this? (I hope the above makes sense)

    Many thanks...
    Last edited by christopherpm; Jun 14th, 2008 at 02:57 PM.

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