Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

i have written a visual basic.net 2003 application and upon it closing I want it to kill all instances of the application that are running, so I used the code below

 

Dim proc() as Process

proc = Process.GetProcessesByName("AppName")

 

For Each SingleProcess as Process in Proc

SingleProcess.Kill

Next

 

 

The above code works generally well but there are occasions when it will not close all instances of the application and I am not sure why. If anyone can shed some light as to the reason, it would be greatly appreiciated.

 

Thanks

Posted
If you are killing all instances of the application - think about what will happen if this loop kills itself before the remaining instances are killed.....

 

 

You were absolutely correct it was killing itself before the it killed the other instances. Thanks for your help.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...