This code snippet will allow you to send files to recycle Bin Using VB.NET Applications.

Code:
Option Strict Off

Option Explicit On

Imports System.IO

Module Module1

   

  Private Structure SHFILEOPSTRUCT

    Dim hwnd As Integer

    Dim wFunc As Integer

    Dim pFrom As String

    Dim pTo As String

    Dim fFlags As Short

    Dim fAnyOperationsAborted As Boolean

    Dim hNameMappings As Integer

    Dim lpszProgressTitle As String

  End Structure

   

  Private Const FO_DELETE As Short = &H3s

  Private Const FOF_ALLOWUNDO As Short = &H40s

  Private Const FOF_NOCONFIRMATION As Short = &H10s

   

  Private Declare Function SHFileOperation Lib "shell32.dll" Alias _

    "SHFileOperationA" (ByRef lpFileOp As SHFILEOPSTRUCT) As Integer

   

  Public Function Recycle(ByRef sPath As String) As Integer

      Dim FileOp As SHFILEOPSTRUCT

      If Not File.Exists(sPath) Then

        MsgBox("Could not find " & sPath & "." & vbCrLf _

        & "Please verify the path.")

        Recycle = -1

        Exit Function

      End If

      With FileOp

        .wFunc = FO_DELETE

        .pFrom = sPath & vbNullChar

        .pTo = vbNullChar

        .fFlags = FOF_NOCONFIRMATION Or FOF_ALLOWUNDO

        .lpszProgressTitle = "Sending " & sPath & " to the Recycle Bin"

      End With

      Try

        SHFileOperation(FileOp)

      Catch ex As Exception

        MsgBox(ex.Message)

      End Try

      Recycle = 0

  End Function

End Module