Imports System.IO Public Class Form1 Private Sub btnScan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnscan.Click btnscan.Enabled = False Dim searchForTheseFiles() As String = txtFileList.Text.ToUpper.Split(Environment.NewLine) Dim fileList As New List(Of String)(searchForTheseFiles) Dim myDir As New DirectoryInfo(cboDriveList.Text) For Each foundFile As FileInfo In myDir.GetFiles("*.*", SearchOption.AllDirectories) If fileList.Contains(foundFile.Name.ToUpper) Then MsgBox("AAAAAHHHHH!!!! VIRUS FOUND!!!") textbox1.Text &= Environment.NewLine & foundFile.FullName Try foundFile.Delete() Catch ex As Exception MsgBox("Couldn't delete infected file!") textbox1.Text &= String.Format("{0}Couldn't delete infected file: {1}", Environment.NewLine, foundFile.FullName) End Try End If Next foundFile btnscan.Enabled = True End Sub Private Function foundFile() As Object Throw New NotImplementedException End Function Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cboDriveList.Items.AddRange(System.IO.Directory.GetLogicalDrives) End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)