[RESOLVED]Webclient downloader
Hi, whats wrong with this code? It doesnt work, because it doesnt download the file, only steps in the DownloadFileCompleted sub. Thank you!
Code:
Imports System.ComponentModel
Imports System.Net
Public Class Form2
Dim hely As String
Public WithEvents wc As System.Net.WebClient
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
wc = New System.Net.WebClient
FolderBrowserDialog1.ShowNewFolderButton = False
FolderBrowserDialog1.Description = "Kérlek válaszd ki a mappát ahova telepiteni szeretnéd!"
FolderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer
If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
hely = FolderBrowserDialog1.SelectedPath
Dim uri As Uri = New Uri("https://drive.google.com/uc?authuser=1&id=1N-ajoDD7VL4NyeRIsiETks2AqPpwbHbP&export=download")
wc.DownloadFileAsync(uri, My.Computer.FileSystem.SpecialDirectories.Temp & "\klienstemp\client.rar")
Else
Me.Hide()
Form1.Show()
End If
End Sub
Private Sub wc_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Handles wc.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
Label1.Text = "Méret: " & Int((e.BytesReceived / 1024) / 1024) & "/" & Int((e.TotalBytesToReceive / 1024) / 1024) & "Megabyte"
End Sub
Private Sub wc_DownloadFileCompleted(sender As Object, e As AsyncCompletedEventArgs) Handles wc.DownloadFileCompleted
Label1.Text = ""
MessageBox.Show("A letöltés befejeződött!", "Felhivás", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Sub
End Class