I was trying to use OpenFileDialog in my button so that when I press it I get the dialogue, I do it in the following way:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim OpenFileDialog1 As OpenFileDialog
With OpenFileDialog1
.FileName = ""
.Filter = ""
.Title = ""
.ShowDialog()
TextBox1.Text = .FileName
infectedfile = TextBox1.Text
End With
End Sub
But it returns the error:
Handles clause requires a WithEvents variable defined in the containing type or one of its base types. (BC30506) - C:\Users\Androide\Documents\SharpDevelop Projects\Form1\Form1\MainForm.vb:19,99
How can I avoid this error?