PDA

Click to See Complete Forum and Search --> : Wait for process


daleG
Oct 31st, 2002, 11:20 AM
I am looping system.diagnostics.process.start this code works when I put a break in the code and single step it thru waiting for each line to finish. but if I don't use a break or step it thru quickly the process I am trying to start doesn't have a chance to finish the first time around before it loops and is ready to start again. Is there a way to make it wait for a process before moving on to the next?

Dim ProgramsSelected As Int16
Dim count As Int16 = 0
ProgramsSelected = newProgramList.SelectedItems.Count
Do
count += 1
System.Diagnostics.Process.Start _(newProgramList.SelectedItem)
newProgramList.SetSelected _(newProgramList.SelectedIndex, False)
Loop Until count = ProgramsSelected

:confused:

hellswraith
Oct 31st, 2002, 11:24 AM
Try putting in Application.DoEvents()

daleG
Oct 31st, 2002, 11:53 AM
I couldnt get that to work. Am I useing it correct?



ProgramsSelected = newProgramList.SelectedItems.Count
Do
count += 1
System.Diagnostics.Process.Start(newProgramList.SelectedItem)
Application.DoEvents()
newProgramList.SetSelected(newProgramList.SelectedIndex, False)
Loop Until count = ProgramsSelected


:confused: