Launch another application and wait for it to complete.

  • Thread starter Thread starter Shelby
  • Start date Start date
S

Shelby

Hi,
if I launch another application in my vb code, how can I wait for it to
complete first?

Dim myProcess As Process
myProcess = New Process
myProcess.Start("test.exe")
' I want to wait for test to complete and continue with other codes
myProcess = Nothing

Thanks
Shelby
 
Hi,
if I launch another application in my vb code, how can I wait for it to
complete first?

Dim myProcess As Process
myProcess = New Process
myProcess.Start("test.exe")
' I want to wait for test to complete and continue with other codes
myProcess = Nothing

Thanks
Shelby

myProcess.WaitForExit()
 
Hi Tom,
it raise an error:
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.dll
Additional information: No process is associated with this object.
 
Shelby,

You are calling waitforexit before you dispose of it? Try this.

Dim p As Process = Process.Start("Notepad.exe")

p.WaitForExit()

p = Nothing



Ken

----------------------------
 
Hi Ken,
thanks for that..

Shelby

Ken Tucker said:
Shelby,

You are calling waitforexit before you dispose of it? Try this.

Dim p As Process = Process.Start("Notepad.exe")

p.WaitForExit()

p = Nothing



Ken
 
Back
Top