Results 1 to 7 of 7

Thread: [RESOLVED]Webclient downloader

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    Resolved [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
    Last edited by Daveeed; Jan 8th, 2019 at 09:09 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width