Question Get Files of Recycle Bin

mansi sharma

Member
Joined
Mar 8, 2009
Messages
16
Programming Experience
Beginner
Hey frnds,I want to get files of Recycle Bin that are currently present in Recycle Bin.can somebody help me out.Cz i have no idea from where to start.
 
VB.Net doesn't have functionality for Recycle Bin, but you can do it with the COM library "Microsoft Shell Controls And Automation" or Windows API. Here's an example for first option, add a reference to that library to use this code:
VB.NET:
Dim items As New List(Of Shell32.FolderItem)
Dim sh As New Shell32.Shell
Dim folder As Shell32.Folder = sh.NameSpace(Shell32.ShellSpecialFolderConstants.ssfBITBUCKET)
For Each item As Shell32.FolderItem In folder.Items
    items.Add(item)
Next
Me.ItemsListBox.DataSource = items
Me.ItemsListBox.DisplayMember = "Name"
Other more interesting properties for the items could be Type (Explorer display string) and Size (bytes integer), IsFolder perhaps, and the Verbs property that expose the actions you can do with the items (Restore, Cut, Delete, Properties).
 
hi John SIr,Thank U very much,its working.....10/10 Marks for ur Answer.Cz i got the best answer & simplest way...without using any API
 
Back
Top