

Imports System.IO
Private Sub opendb(ByVal folderpath As String, ByVal fileExtension As String)
Dim dr As New System.IO.DirectoryInfo(folderpath) ' Dynamically it would be your textbox folder path or whatever
Dim finfo As System.IO.FileInfo() = dr.GetFiles()
For Each fi As System.IO.FileInfo In finfo
If fi.Extension.ToUpper() = fileExtension.ToUpper() Then
fi.Delete()
End If
Next
End Sub
opendb("C:\", ".txt")
