Closing apps?

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts Page 1 of 1
Contributors
User avatar
CodenBoy
Top Poster
Top Poster
Posts: 103
Joined: Sun Jul 15, 2012 4:06 pm

Closing apps?
CodenBoy
Yeah i know i need help again xD

How to close app? i can open them with
Code: Select all
process.start("notepad.exe")
but how to close?

Thanks
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: Closing apps?
comathi
Right below the Class declaration, just before the first Sub, put this:
Code: Select all
Dim app as Process
Wherever you want to start the process, use this:
Code: Select all
app=Process.Start("notepad.exe")
To kill the app, then use this:
Code: Select all
app.Kill()
Taken from http://www.dotnetperls.com/kill-vbnet
User avatar
CodenBoy
Top Poster
Top Poster
Posts: 103
Joined: Sun Jul 15, 2012 4:06 pm

Re: Closing apps?
CodenBoy
Thanks, will the kill code gonna close apps i didnt open? i dont think sp can u give me code to kill or close other apps i didnt open?


Thx brah loove;
User avatar
CodenBoy
Top Poster
Top Poster
Posts: 103
Joined: Sun Jul 15, 2012 4:06 pm

Re: Closing apps?
CodenBoy
Im back, thanks for this code but the one i need isnt this, cuz, I cant kill("notepad.exe") and i tried many others, didnt work,
and i need it to kill any thing not as this code, this cant work for what i need :)

Thanks
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Re: Closing apps?
M1z23R
Code: Select all
        For Each p As Process In System.Diagnostics.Process.GetProcesses
            If p.ProcessName.Contains("notepad") Then
                p.Kill()
            End If
        Next
5 posts Page 1 of 1
Return to “Coding Help & Support”