Results 1 to 12 of 12

Thread: [RESOLVED] VB Downloader not working

Threaded View

  1. #1

    Thread Starter
    Addicted Member Reapism's Avatar
    Join Date
    Sep 2012
    Posts
    170

    Resolved [RESOLVED] VB Downloader not working

    What I want the program to do/What is happening.


    How come this doesn't work??? I want the user to select one of the following items in a listbox and the direct link will appear in the DwlLocation textbox and then afterthat the user presses download and it asks where to save the file then the user inputs a file name and then if begins downloading with the progress bar in sync with actual progress. This worked for me individually then I sent it to my friend and it didn't work it would make a file with 0KB and its damaged. Then after I tryed and it didn't work for me as well! I really appreciate you for reading this!

    Code:
         Private Sub BtnDownload_Click(sender As System.Object, e As System.EventArgs) Handles BtnDownload.Click
            If Lstavailable.SelectedItem = Nothing Then
                MsgBox("Please choose a picture to download", MsgBoxStyle.Critical, "Error Selection")
            Else
                SaveFilePic.Filter = ".png|*.png"
                SaveFilePic.Title = "Choose where to download it to!"
                SaveFilePic.ShowDialog()
                If SaveFilePic.FileName = Nothing Then
                    MsgBox("Please name your saved file or unable to complete request.", MsgBoxStyle.Critical)
                    TxtDwlSrc.Clear()
                Else
                    TxtDwlLocation.Text = SaveFilePic.FileName
                    WebClient.DownloadFileAsync(New Uri(TxtDwlSrc.Text), TxtDwlLocation.Text)
                    Lstavailable.Enabled = False
                End If
            End If
        End Sub
    
        Private Sub WebClient1_DownloadFileCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs) Handles WebClient.DownloadFileCompleted
            Dim selectPic As String
            selectPic = LstMaps.SelectedItem
            MsgBox(selectPic & " finished downloading!", MsgBoxStyle.Information, "Pictures")
        End Sub
    
        Private Sub WebClient1_DownloadProgressChanged(sender As Object, e As System.Net.DownloadProgressChangedEventArgs) Handles WebClient.DownloadProgressChanged
            DwldProgress.Value = e.ProgressPercentage
            Text = "download pictures" & " - " & e.ProgressPercentage.ToString + "%" & " Downloaded."
    
        End Sub
    
        Private Sub Lstavailable_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles Lstavailable.SelectedIndexChanged
            If Lstavailable.SelectedItem = "Terminal" Then
               
    
                TxtDwlSrc.Text = "the direct download link here" 'Keep in mind where I put "the direct download link here" its the direct link to the file.
            ElseIf Lstavailable.SelectedItem = "Alle" Then
                TxtDwlSrc.Text = "the direct download link here"
            ElseIf Lstavailable.SelectedItem = "Mary" Then
                MsgBox("the direct download link here")
                TxtDwlSrc.Clear()
            End If
        End Sub
    End Class
    Changed event "WebClient1" to "WebClient" = Still Not Resolved.

    Problem: Once I press download it says finished downloading and blank damaged file appears.
    Last edited by Reapism; Mar 24th, 2013 at 08:35 PM.

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