Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
In my system I open several word document.
I want to kill a particular word document using vb.net/ c#.

Please anybody help.

currently I am using below code which is killing all word application

VB
' Kill  word application
if  isWordRunning =true then
For Each process As Process In Process.GetProcessesByName("winword.exe")
    process.Kill
    process.WaitForExit
Next
end if
' Get any word application is runing or not
    Private Function isWordRunning() As Boolean
        Return (System.Diagnostics.Process.GetProcessesByName("winword").Length > 0)
    End Function
Posted

If you can somehow get hold of the process id or the session id of that particular application, then it should be easy.
 
Share this answer
 
Comments
RaviRanjanKr 3-Feb-11 0:30am    
Good answer Abhinav. my 5!
Abhinav S 3-Feb-11 0:55am    
Many thanks Ravi.
yeah as Abhinav suggest you it can be possible by store ProcessID and then kill process by ID of that particular application.
I got some link and Hope these Link1[^] and Link2-[Store ProcessID and Kill Process by PID][^] might help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900