Using VB.Net to Open/Close files

comtrendz

New member
Joined
Oct 5, 2006
Messages
2
Programming Experience
1-3
Hi,

I am writing a new App that requires 4 thumbnail viewer of jpg's or Word Docs to be displayed in a form(FormB). No problems up to this point.
The requirement is to Open 1 or more of the jpg or docs on request for viewing purposes and then shut them down automatically once FormB is closed.
So I have 4 button to open the individual files using Start(filename) and I have also used System.Diagnostics.Process.Start(filename) and all the opens work just fine.

My problem is shutting down the open docs/jpg when FormB get closed.

Hopefully someone has gone through this painfull excercise and they can help me out here.

PS: I'n new to Vb.Net go please explain clearly

appreciate the help

Thanks
Gab:)
 
Process.Start function return the instance of Process started. You need to keep this instance for use later. Later when you close application (Form.Closing event) you get all the Process instances you saved and check their .HasExited property and use the .Kill method if needed. Here is the Process members, you can click into the members I mentioned and there is code examples there too.
 
Back
Top