PT Exorcist
Jul 17th, 2002, 01:19 PM
i put this code in a class...
Public Event DownloadComplete(ByVal Status As Integer, ByVal ReturnValue As String, ByVal URL As String, ByVal FileName As String)
'~~~~~~~~~~~~~~~~~~
Sub DownloadPicture()
Dim MyWebClient As WebClient = New WebClient()
Try
MyWebClient.DownloadFile(URLName, LocalFileName)
Catch ex As Exception
RaiseEvent DownloadComplete(0, ex.Message, "", "")
Finally
RaiseEvent DownloadComplete(1, "Imagem carregada com sucesso no disco rigido!", "", "")
Msgbox("download complete!")
End Try
End Sub
and then in form i have
Private WithEvents Dev As New Deviations()
Private Sub Dev_DownloadComplete(ByVal Status As Integer, ByVal ReturnValue As String, ByVal URL As String, ByVal FileName As String) Handles Dev.DownloadComplete
MsgBox(Status)
End Sub
but the Dev_DownloadComplete is never fired although the msgbox saying "download complete" is fired!!! grrrrr
what am i missing..?
Public Event DownloadComplete(ByVal Status As Integer, ByVal ReturnValue As String, ByVal URL As String, ByVal FileName As String)
'~~~~~~~~~~~~~~~~~~
Sub DownloadPicture()
Dim MyWebClient As WebClient = New WebClient()
Try
MyWebClient.DownloadFile(URLName, LocalFileName)
Catch ex As Exception
RaiseEvent DownloadComplete(0, ex.Message, "", "")
Finally
RaiseEvent DownloadComplete(1, "Imagem carregada com sucesso no disco rigido!", "", "")
Msgbox("download complete!")
End Try
End Sub
and then in form i have
Private WithEvents Dev As New Deviations()
Private Sub Dev_DownloadComplete(ByVal Status As Integer, ByVal ReturnValue As String, ByVal URL As String, ByVal FileName As String) Handles Dev.DownloadComplete
MsgBox(Status)
End Sub
but the Dev_DownloadComplete is never fired although the msgbox saying "download complete" is fired!!! grrrrr
what am i missing..?