visual studio 2012 express *Error*

i was making a downloader and when i was debugging it i found 1 error:

Handles clause requires a WithEvents variable defined in the containing type or one of its base types.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Imports System.Net
Public Class Form1

    Private Sub cmdsave_Click(sender As Object, e As EventArgs) Handles cmdsave.Click
        SaveFileDialog1.Filter = ".jpg|*.jpg|.exe|*.exe|.zip|*.zip|.rar|*.rar|.png|*.png|.gif|*.gif|.mp4|*.mp4|.iso|*.iso|.mp3|*.mp3"
        SaveFileDialog1.ShowDialog()
        TextBox2.Text = SaveFileDialog1.FileName
    End Sub
    Public WithEvents download As WebClient
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        download = New WebClient
        download.DownloadFileAsync(New Uri(TextBox1.Text), TextBox2.Text)

    End Sub

    Private Sub download_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Handles download.DownloadProgressChanged
        ProgressBar1.Value = e.ProgressPercentage
    End Sub
End Class


the error was found where it says:


Private Sub cmdsave_Click(sender As Object, e As EventArgs) Handles cmdsave.Click

the last 2 word of this line :cmdsave.Click
Last edited on
It looks like Visual Basic. Maybe you should have posted it in the Lounge section.
Topic archived. No new replies allowed.