hello guys, i'm just fooling around with vb 2008, and i thought i'd try to make a simple anti virus. my problem is that it only detects and deletes one of the files, i know it's because i use else if, but i don't know what else to use ?

if i put a steal.exe in my C drive it deletes it, if i put a hack.exe in my C drive it deletes it, but it wont delete both at the same time, so i just want to know what to use instead of else if?

Dim fiFile As New System.IO.FileInfo("C:\Steal.exe")
            Dim fiFile1 As New System.IO.FileInfo("C:\Virus.exe")
            If fiFile.Exists Then
                Virus.Items.Add("Stealer Detected (C:\Steal.exe)")
                Label1.Text = "Status : Deleting"
                fiFile.Delete()
                Virus.Items.Add("Stealer Deleted (C:\Steal.exe)")
                Label1.Text = "Status : Finished"
            ElseIf fiFile1.Exists Then
                Virus.Items.Add("Hack Detected (C:\Virus.exe)")
                Label1.Text = "Status : Deleting"
                fiFile1.Delete()
                Virus.Items.Add("Hack Deleted (C:\Virus.exe)")
                Label1.Text = "Status : Finished"

if elseif elseif elseif elseif elseif else
only ever runs ONE of the available choices. As soon as one of the if statements is true, that's all there is.

Try a sequence of separate if statements.

i already tried separating if statements.. :/ and what's a sequence?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.