ich habe mir gerade ein downloader geschrieben wenn ich allerdings denn download button klick sagt er sofort der download sei fertig
hier mal das skript könnte mir jemand sagen was falsch ist :)
hier mal das skript könnte mir jemand sagen was falsch ist :)
Code:
Imports System.Net
Public Class Form1
Public WithEvents Downloader As WebClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Downloader = New WebClient
Downloader.DownloadFileAsync(New Uri(TextBox1.Text), TextBox2.Text)
Me.Button1.Enabled = False
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim speichern = New FolderBrowserDialog
speichern.ShowDialog()
Me.TextBox2.Text = speichern.SelectedPath
End Sub
Private Sub Downloader_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles Downloader.DownloadFileCompleted
MsgBox("Der Download ist Fertig!", MsgBoxStyle.Information, "Download beendet")
Me.ProgressBar1.Value = 0
Me.Label2.Text = "0 von 0 Bytes"
Me.Label3.Text = "0%"
Me.Button2.Enabled = True
End Sub
Private Sub Downloader_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles Downloader.DownloadProgressChanged
Me.ProgressBar1.Value = e.ProgressPercentage
Me.Label2.Text = e.BytesReceived & "von" & e.TotalBytesToReceive & "Bytes"
Me.Label3.Text = e.ProgressPercentage & "%"
End Sub
End Class