469,646 Members | 1,590 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,646 developers. It's quick & easy.

Launch another application and wait for it to complete.

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
Nov 20 '05 #1
4 7622
On Wed, 7 Jul 2004 13:18:36 +0800, Shelby wrote:
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()

--
Tom Shelton [MVP]
Nov 20 '05 #2
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.

"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:ig*****************************@40tude.net...
On Wed, 7 Jul 2004 13:18:36 +0800, Shelby wrote:
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()

--
Tom Shelton [MVP]

Nov 20 '05 #3
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

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

"Shelby" <sh****@itsupport.com.sg> wrote in message
news:OR****************@tk2msftngp13.phx.gbl...
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.

"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:ig*****************************@40tude.net...
On Wed, 7 Jul 2004 13:18:36 +0800, Shelby wrote:
> 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()

--
Tom Shelton [MVP]


Nov 20 '05 #4
Hi Ken,
thanks for that..

Shelby

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eV*************@TK2MSFTNGP09.phx.gbl...
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

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

"Shelby" <sh****@itsupport.com.sg> wrote in message
news:OR****************@tk2msftngp13.phx.gbl...
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.

"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:ig*****************************@40tude.net...
On Wed, 7 Jul 2004 13:18:36 +0800, Shelby wrote:

> 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()

--
Tom Shelton [MVP]



Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Konrad | last post: by
1 post views Thread by Leonid Finis | last post: by
2 posts views Thread by Peter Ignarson | last post: by
4 posts views Thread by Andrew | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.