ich will den filename abfragen bekomm das aber irgendwie nicht hin hab schon endliche foren etc durchsucht aber komm nicht weiter
Kompletter Code:
Code:
Imports System.Net
Imports System.IO
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), 123)
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("Download beendet", MsgBoxStyle.Information, "Fertig!")
Me.ProgressBar1.Value = 0
Me.Label3.Text = "0 von 0 bytes"
Me.Label4.Text = "0%"
Me.Button1.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.Label3.Text = e.BytesReceived & "Von " & e.TotalBytesToReceive & "Bytes"
Me.Label4.Text = e.ProgressPercentage & "%"
End Sub
End Class
Code:
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), Hier muss der file name hin)
Me.Button1.Enabled = False
End Sub






