Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hai
why i am asking this question ,i want delete all file in a specific folder(Temp),in that all files are pdf file ,that file are download form sql server and save in Temp folder and open in pdf viewer.After i see pdf file i close the application(Windows application in vb.net),I WANT TO DELETE ALL FILES IN TEMP FOLDER BEFORE CLOSE THE APPLICATION.If pdf file open in pdf viewer i cant delete file form Temp folder and it show error like "File cannot be delete,because it used by another application " something like this....
If file not open in viewer i can delete Temp folder but if file open in viewer i can't delete folder
pls reply asap
Posted
Comments
Aravindba 7-Mar-13 22:15pm    
ok,But pdf file is open in viewer i cant delete that file,before close the application i want clear all files in Temp folder .Otherwise user every time see the pdf file it download form sql server as binary form and convert into original pdf file and save in temp folder if not delete it save lot of file and it deceased the space in drive.
Sergey Alexandrovich Kryukov 8-Jul-13 14:08pm    
Please stop posting non-answers as "solution". It can give you abuse reports which eventually may lead to cancellation of your CodeProject membership.
Comment on any posts, reply to available comments, or use "Improve question" (above).
Also, keep in mind that members only get notifications on the post sent in reply to there posts.
—SA

You can use FILE.Delete() method

Or You can use
My.Computer.FileSystem.DeleteFile()

For Reference Please find
http://msdn.microsoft.com/en-us/library/h63bz6ys%28VS.80%29.aspx[^]
 
Share this answer
 
Hai
I solved this problem by first remove file from pdf viewer,if file not open in viewer no problem otherwise file is open in viewer we have to clear that file and use delete method to clear folder.
Thanx for reply "nitin bhoyate"
 
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