none
Progressbar

    Question

  • Hello! It's ok ? I am developing file downloader. I'm a beginner, I want to put a progress bar in the download. Could someone help me with a sample code? My knowledge is little. If it were possible, the more details and explanations they gave me, the better it would be for me. Thank you: D

        Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
            If My.Computer.FileSystem.FileExists("C:download.jpg") = True Then
                MsgBox("Arquivo já existente", vbCritical, "Download")
                Exit Sub
            Else
                If My.Computer.FileSystem.FileExists("C:download.jpg") = False Then
                    My.Computer.Network.DownloadFile("http://tvcultura.com.br/upload/tvcultura/programas/programa-imagem-som.jpg", "C:\Users\thiag\Downloads\arquivo.jpg")
                    Shell("explorer C:\download.jpg", vbHide)
                End If
            End If
        End Sub


    Wednesday, April 05, 2017 12:58 AM

All replies

  • I am developing file downloader. I'm a beginner, I want to put a progress bar in the download. Could someone help me with a sample code?

    If you use the overload of DownloadFile that takes the showUI argument, then the user will see a download dialog that includes a progress bar.  Otherwise there is no way to use a progress bar with the DownloadFile method because you do not have access to the progress information.
    https://msdn.microsoft.com/en-us/library/ack30t8y(v=vs.90).aspx

    Otherwise, use something like the method described here:
    http://www.dreamincode.net/forums/topic/185093-download-file-asynchronously-with-progressbar/

    Wednesday, April 05, 2017 1:21 AM
  • I am developing file downloader. I'm a beginner, I want to put a progress bar in the download. Could someone help me with a sample code?

    If you use the overload of DownloadFile that takes the showUI argument, then the user will see a download dialog that includes a progress bar.  Otherwise there is no way to use a progress bar with the DownloadFile method because you do not have access to the progress information.

    Otherwise, use something like the method described here:

    I'm a beginner, can you explain me a little more detail? Please, it's very important to me, I've seen this example before, I did not understand it.
    Wednesday, April 05, 2017 1:53 AM
  • I'm a beginner, can you explain me a little more detail? Please, it's very important to me, I've seen this example before, I did not understand it.

    You will need to explain which of the options you have selected, and exactly which part of the example you are having a problem with.

    Wednesday, April 05, 2017 6:00 AM
  • Hi Thiagohc16,

    Based on your description, you want to download file with progressbar, please refer to this sample.

    https://www.codeproject.com/Articles/17979/Downloading-Files-in-NET-With-All-Information-Prog

    Best Regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 05, 2017 9:51 AM
    Moderator