.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Code Snippets >> Windows Form Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Delete File and Send it to RecycleBin

Posted By:Hiren Soni       Posted Date: August 29, 2010    Points: 10    Category: Windows Form Controls    URL: http://www.dotnetspark.com  

Delete File and Send it to RecycleBin

Delete File and Send it to RecycleBin

When we use File.Delete(path);

It automatically delete file .

It cannot be recover.

It never go in Recycle Bin.

So delete operation must be done with care.

So here is a code which delete file and send to recycle bin.

First add reference Microsoft.VisualBasic

And use the following code to delete file:

using Microsoft.VisualBasic;

string path = @"C:\1.txt";



Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend