Hi i just started visual basic a few month back and i made myself a anti virus program and when i finished it, it just say
InvalidArgument =Value of '0' is not valid for 'SelectedIndex'.
Parameter name: SelectedIndex
Here's the full coding
InvalidArgument =Value of '0' is not valid for 'SelectedIndex'.
Parameter name: SelectedIndex
Here's the full coding
Code:
Public Class Form1
Dim percent = 0
Dim red
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button3.Enabled = False
Button1.Enabled = False
Button2.Enabled = False
ComboBox1.SelectedIndex = 0
ComboBox1.Items.AddRange(System.IO.Directory.GetLogicalDrives)
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
percent = (ListBox2.Items.Count / ListBox1.Items.Count - 1) * 100
If (ListBox1.SelectedIndex < ListBox1.Items.Count - 1) Then
End If
ProgressBar1.Value = 1
Label2.Text = "scanning fort: " & ListBox1.SelectedItem
ListBox2.Items.Add("scanning: " & ListBox1.SelectedItem)
Try
If Dir(ListBox1.SelectedItem.ToString) <> "" Then
ListBox3.Items.Add("Thread Found: " & ListBox1.SelectedItem.ToString)
ElseIf Dir(ListBox1.SelectedItem.ToString, FileAttribute.Hidden) <> "" Then
ListBox3.Items.Add("Thread Found: " & ListBox1.SelectedItem.ToString)
Else
End If
Catch ex As Exception
End Try
ListBox1.SelectedIndex += 1
If ListBox3.Items.Count - 1 >= 1 Then
ListBox3.SelectedIndex = 0
Button3.Enabled = True
End If
Timer1.Stop()
ProgressBar1.Value = 100
Label2.Text = "Finished Scanning. " & ListBox3.Items.Count & " Threads Found"
Button2.Enabled = False
Button1.Enabled = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ProgressBar1.Value = 0
ListBox2.Items.Clear()
ListBox3.Items.Clear()
percent = 0
Button1.Enabled = False
ListBox1.TabIndex = 0
Timer1.Start()
Button2.Enabled = True
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedIndex >= 1 Then
ListBox1.Items.Clear()
TextBox1.Text = My.Resources.Viruslist.ToString
For Each line As String In TextBox1.Lines
ListBox1.Items.Add(ComboBox1.SelectedItem.ToString & line.ToString)
Next
If ListBox1.Items.Count = 1 >= 0 Then
Label1.Text = "Database Loaded!"
Button1.Enabled = True
Else
Label1.Text = "No Database Loaded!"
Button1.Enabled = False
End If
Else
Button1.Enabled = False
ListBox1.Items.Clear()
TextBox1.Text = ""
Label1.Text = "No Database Loaded!"
End If
End Sub
Private Sub Label1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.TextChanged
If Label1.Text = "Database loaded!" Then
Button1.Enabled = True
Else
Button1.Enabled = False
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If ListBox3.Items.Count - 1 >= 0 Then
ListBox3.Enabled = True
Button3.Enabled = True
Else
Button3.Enabled = False
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
If ListBox3.Items.Count - 1 >= 0 Then
ListBox3.SelectedIndex = 0
Button3.Enabled = True
End If
Button2.Enabled = False
Button1.Enabled = True
End Sub
End Class