none
how can i download large files with webclient?

    Question

  • hey im trying to download a large file but cant do it with my normal script:

    Dim SFD As New SaveFileDialog If SFD.ShowDialog() = DialogResult.OK Then wc2.DownloadFile(New Uri("url"), SFD.FileName) End If

     Private Sub wc2_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Handles wc2.DownloadProgressChanged
            ProgressBar1.Maximum = e.TotalBytesToReceive
            ProgressBar1.Value = e.BytesReceived
        End Sub

     Private Sub wc2_DownloadFileCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs) Handles wc2.DownloadFileCompleted
            MsgBox("Done")
            ProgressBar1.Value = 0
        End Sub

    can any help me we talking about 5,5gb

    Sunday, July 14, 2013 8:33 PM

Answers

  • I have also discovered that progress bar, and percentage text does not work on the large file. i have downloaded 500MB with the program but it still remains at 0.0 percent, and the progress bar has Marquee style so i can not see it  i can only see it because I checkkker on the downloaded file's properties but only with the large file.

    BY DESIGN Kris,

    Look at the code. The synchronous method is a blocking call - so the program cannot report progress on anything until AFTER a file has been downloaded, then it looks at the history and makes the calculations. Until then, it has no idea what's going on.

    This is what I expected and what I said five days ago.

    If you're truly disappointed with the outcome then by all means UNMARK ME AS THE ANSWERER!

    I'll be offline for several hours either way ... but it's doing what I said it would do almost a week ago now.

    I'm done with this thread now and I've only ever said that one other time.


    Please call me Frank :)

    • Marked as answer by kris914g Friday, July 19, 2013 8:09 PM
    Friday, July 19, 2013 7:55 PM

All replies

  • The size of the download [should] have nothing to do with it. Is it showing an exception or what is it doing/not doing?

    My first thought is that the URI is malformed - but I can't know that. Let me also caution you that your download progress changed event may not work like you think it will. e.TotalBytesToReceive may not work at all, or that's what I've found unless they've fixed it in recent years.


    Please call me Frank :)

    Sunday, July 14, 2013 8:39 PM
  • Your code snippets don't go together.  Are you downloading synchronously or asynchronously?  Post the appropriate code.
    Sunday, July 14, 2013 9:38 PM
  • Your code snippets don't go together.  Are you downloading synchronously or asynchronously?  Post the appropriate code.

    Oh you're right!

    Dang I can't believe I missed that!

    *****

    Kris,

    Only asynch mode supports the events. I'm sorry that I didn't see that.


    Please call me Frank :)

    Sunday, July 14, 2013 9:41 PM
  • Kris,

    I don't think you're out of the woods yet though. First is how you're setting up your ProgressBar. If you're talking about 5.5 gigs, you're in excess of the maximum value (an Int32), at least if I did the math right - which I may not have.

    Either way though, I think you're better off to always set the minimum to 0, the maximum to 100, then compute the percentage in code. Send it the integer value of that calculation.

    -----

    If you choose to use the asynchronous method, then you might be stuck on what I brought up earlier about e.TotalBytesToReceive. I can show you another way to get that information though, if you're interested.

    If you choose to set it up synchronously, like you have it, then understand that it's a blocking mode - your UI will be totally unresponsive. There's still a way to do that and get the progress along the way, although you won't be using an event.

    I'll wait for you to reply before i continue on, but John is right - no events are available with the synchronous mode of the download.


    Please call me Frank :)

    Sunday, July 14, 2013 10:04 PM
  • Hi,

     If you are trying to download the file asynchronously so its not blocking and want to show the progress in a progressbar then you could try setting your code up something like this. However, before downloading files be sure to check out the websites TOU (Terms Of Use) and make sure you are not violating any of them.

    Public Class Form1
        Dim WithEvents wc2 As New Net.WebClient
    
        Private Sub Button_Download_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Download.Click
            Button_Download.Enabled = False
            Dim urlStr As String = "http://SomeWebSite.org/pics/SomePicture.jpg"
            Dim fName As String = urlStr.Substring(urlStr.LastIndexOf("/") + 1)
    
            Dim SFD As New SaveFileDialog
            SFD.FileName = fName
            SFD.DefaultExt = System.IO.Path.GetExtension(fName)
            SFD.AddExtension = True
            If SFD.ShowDialog() = DialogResult.OK Then
                wc2.DownloadFileAsync(New Uri(urlStr), SFD.FileName)
            End If
        End Sub
    
        Private Sub wc2_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles wc2.DownloadFileCompleted
            MessageBox.Show("Done")
            ProgressBar1.Value = 0
            Button_Download.Enabled = True
        End Sub
    
        Private Sub wc2_DownloadProgressChanged1(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles wc2.DownloadProgressChanged
            ProgressBar1.Maximum = 100
            ProgressBar1.Value = e.ProgressPercentage
        End Sub
    
        Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
            wc2.Dispose()
        End Sub
    End Class
    

    Monday, July 15, 2013 4:54 AM
  • thanks for your helping frank IronRazerz and John i think i will use the asynchronous method so my form is responsable thanks for the help but i have a new question how can i add status text exempel:

    total download:

    downloaded:

    speed:

    time left:

    percentage:

    how can i get the stats for download? i have no idea how i can do it but it can be nice if any can help me






    • Edited by kris914g Monday, July 15, 2013 2:32 PM grama fail
    Monday, July 15, 2013 2:31 PM
  • i think i will use the asynchronous method so my form is responsable

    Kris,

    How many files are you downloading? Understand that using it in asynch mode, it will start a new thread per call. Since it's a nonblocking call, you could easily rack up every file being downloaded all at once (it would fail, but it would try).

    That's not easily handled if it's for multiple files (and how would you deal with the event reporting?)

    Let me know then we'll discuss it from there.


    Please call me Frank :)

    Monday, July 15, 2013 5:34 PM
  • hey i want to have alot of checkboxes. and for every checkboxes there is a download so if i select 4 checkboxes out of 10 checkboxes i get 4 downloads with progress bar and status text:

    total download:

    downloaded:

    speed:

    time left

    percentage:

    and if possible to download the files one at a time?


    • Edited by kris914g Monday, July 15, 2013 5:45 PM grama fail
    Monday, July 15, 2013 5:44 PM
  • hey i want to have alot of checkboxes. and for every checkboxes there is a download so if i select 4 checkboxes out of 10 checkboxes i get 4 downloads with progress bar and status text:

    total download:

    downloaded:

    speed:

    time left

    percentage:

    and if possible to download the files one at a time?


    In the forthcoming weeks, I'll be posting something "generic" about uploading/downloading using the asynch method which handles multiple files.

    It *can* be done but it can't be allowed to run more than one thread for a number of reasons (including the fact that the web host would likely close the connections when it sees that many at once).

    I say that I will - I've thought about it a while, but I've never put anything together, but I do have an idea on it.

    That being neither here nor there, I think the simplest way would be to do them serially, synchronously, but run it in a background worker and report things "per file" rather than in real time.

    What you're asking for is a tall order and doing it the way I just said will be somewhat disappointing (but the idea that I have for a generic one would do exactly what you want - but that's a long way out, if I ever do actually get to putting it together).

    I can get you started on the backgroundworker and synchronous downloading if you want, but even that will take me a while, so I don't want to start on it until I hear back from you.


    Please call me Frank :)

    Monday, July 15, 2013 5:53 PM
  • i will be happy if you will help me with the backgroundworker and synchronous downloading
    Monday, July 15, 2013 6:23 PM
  • i will be happy if you will help me with the backgroundworker and synchronous downloading

    This will take a while but I'll see what I can do.

    I'm at work now, so I may have to postpone this some, but I'll get started on it soon.


    Please call me Frank :)

    Monday, July 15, 2013 6:29 PM
  • okay thanks
    Monday, July 15, 2013 7:40 PM
  • okay thanks

    Kris,

    I have a pretty simple downloader put together which uses FTP to download. If you’re using HTTP, then you can modify it as it’s a simpler download process (no logging in), but not knowing, I assumed FTP.

    The WebClient will handle it either way though. We’ll be using this method and, as you can read there:

     

    This method uses the RETR command to download an FTP resource. For an HTTP resource, the GET method is used.

     

    So it’s well equipped either way.

    I have the form set up like this:

    As you can see above, the label is set with AutoSize off and I've sized it to be able to show the information as the files download.

    The basis of this is by using a BackgroundWorker as I said earlier, and to let it know just what to do, we’ll send in a instance of a class which you’ll see defined in the code. The class doesn’t really *do* anything; it just stores the various information and by using a class, the fact that it’s a single object makes it easy to work with.

    The name of the class is  FTP_DownloadFileList and the constructor for it (or one of them, to be more specific) requires that you send in the following:

     

    • Server Name
    • User Name
    • Password
    • HTTP Base URL
    • List Of Files On The Remote Server To Download (the file names)
    • The folder on the user’s computer to download it to
    • [Optional] Force an overwrite, even if the local file exists and is the correct size.

     

    These are all pretty basic and you should have them already. If you're confused on some of them, when I show the code momentarily look at the constants that I have declared at the top of the code. That should give you a good idea of what the constructor is looking for. That information is real - in fact, if you want to (or anyone else listening in), feel free to experiment with this program 'as is' - it should work just like I show it herein.

    What I’ve done for this test was to grab some images that a friend of mine sent to me several years ago while they were in Hawaii on vacation.

    I’ve intentionally removed some of them from the server and this is a good test of my method here. It’s entirely possible that you think the file is on the server but in fact you never uploaded it.

    How you come up with your list of file names is up to you; in mine you’ll see that in the Start button’s click event, I iterate through the folder on my hard drive to get the file names of what I uploaded (including the ones I removed); obviously you'll need to modify that in your program.

    In that click event, I then instantiate (create a new instance of) that class and enter in the various parameters. Once done, that instance is then passed into the BackgroundWorker and all of the rest of the work is now done there.

    This is how the user interface stays responsive; the BGW is running everything on another thread and reports progress along the way. Here’s what the user will see:

    There are two loops inside the BGW’s .DoWork event: The first loop (shown above) looks on the remote server and gets the file size of each file in the list of files which were sent to it. If the file size is returned as -1, it’s NOT included in what to try to download (thus the test I talked about earlier).

    Let me divagate here and discuss the function that I put together to get those remote file names’ sizes:

    The function is overloaded – you have an option of using an HTTP method or an FTP method. If your site has an HTTP method that’s exposed (not something private that we can’t reach), that’s what the program will defer to, but if it doesn’t (just leave the base HTTP URL set to a blank string in the constructor), then it will use the FTP method.

    The HTTP method is a LOT faster though – because unlike FTP, there’s no login required.

    Back to the BGW though, once it’s looked through the list of files (it creates its own internal List(Of String) to use for this purpose), now it starts the second loop. This is where the actual downloading takes place so I’ll just show the progress of things following:

    When the overall progress is under 1%, the progress bar will display as a marquis. Then after at least 1%, it will show as a normal progressbar:

    Once at least one minute has passed and at least 3% has been downloaded, it will then add some additional information as shown here:

    So what happens if they cancel it? Well let’s try it and see:

    Now when I restart it:

    Take note in the screenshot above that the size (quantity) of the list has changed. It’s once again gone through that preliminary loop and one part in that loop is to look to see if the file already exists on the user’s computer (where you told it to be downloaded to) and, if so, if the file size matches the remote file size. If so, it’s skipped so thus the internal list has now been modified to only download whatever is left.

    Do note something here please: This process only instructs it whether or not to download it. If yes, and if any part of the file exists in their download folder, it’s overwritten; that is, it is NOT an FTP resume. A resume can be done but it’s an involved bit and I won’t bother – I just overwrite it from scratch.

    Finally then, once it goes all the way through, it shows the following:

    ---

    This whole thing can be greatly embellished and improved. For instance, there might be a post download operation to iterate through the local files and ensure their filesize matches that of the remote files' size.

    That’s one of many improvements that you might embellish this, but hopefully this will get you started at least.

    The code is a few hundred lines long so I won’t try to post it here. Instead I have it on a page of my website here and I hope you find it helpful. :)


    Please call me Frank :)

    • Marked as answer by kris914g Tuesday, July 16, 2013 5:55 PM
    • Unmarked as answer by kris914g Friday, July 19, 2013 8:06 PM
    Monday, July 15, 2013 9:48 PM
  • thanks Frank that is good form you have maked. :) but how can i do it with checkboxes and urls?
    Tuesday, July 16, 2013 1:54 PM
  • thanks Frank that is good form you have maked. :) but how can i do it with checkboxes and urls?

    Well that's fairly basic stuff.

    First, are you going to be downloading using HTTP or FTP?


    Please call me Frank :)

    Tuesday, July 16, 2013 2:01 PM
  • i will use http and checkboxes so  for 1 download there is a checkbox so pls can you remake your awesome project to http and checkboxes?
    Tuesday, July 16, 2013 3:08 PM
  • i will use http and checkboxes so  for 1 download there is a checkbox so pls can you remake your awesome project to http and checkboxes?

    Bear with me a few hours - real work has to come first ... I'm sure you understand.

    I'll see what I can come up with in a while though.


    Please call me Frank :)

    Tuesday, July 16, 2013 3:22 PM
  • thanks give yourself all the time you need
    Tuesday, July 16, 2013 3:27 PM
  • i will use http and checkboxes so  for 1 download there is a checkbox so pls can you remake your awesome project to http and checkboxes?

    Kris,

    I have modified the program to now allow either FTP or HTTP downloading. I thought it would be better to do it that way for people who might later find this thread. This way, this will do either one.

    I’ve changed the form to now have a TabControl on the top with two TabPages:

    • Download Via FTP
    • Download Via HTTP

    In my example here, either way it will download the same files. In fact, you could use both simultaneously if you wanted to. I don’t know why you would, but the fact that it’s two separate BackgroundWorkers, it would do both at the same time (but be sure to pick different download folders!).

    Rather than using checkboxes though, I chose to use a CheckedListBox control and I would suggest that you do the same. The reason is simple: Built-in versatility. If at some point in the future your ten becomes twenty-five (or maybe just five), this will deal with it gracefully; it will show whatever items you instruct it to in your code.

    Here’s how the form is now set up:

    FTP Downloading

    HTTP Downloading

    The code now has a new Namespace and in that Namespace, the Class from yesterday and a new one, similar to that one, but this one specifically for HTTP.

    For that reason, one of the imports statements merits some discussion because it might throw you:

     

    Imports Simple_Downloader.DownloadData

     

    The Namespace is called “DownloadData”, but as you see above, it’s preceded by the name of where it is – which is your assembly name. Since my program’s name is “Simple_Downloader”, that’s what you see above, so you’ll need to modify yours accordingly.

    When the program starts, in the .Load event, I populate the CheckedListBox with the filenames of the of images which I uploaded yesterday:

    When the user clicks the “Start Download” button, I then set up a local list of the full URL’s by combining the base HTTP URL (one of the constants from yesterday) with the name from the CheckedListBox, but in yours – assuming that you already know the full URL – you’ll probably want to do it differently.

    Either way though, what you send to constructor of the new class needs to be a List(Of String) which consists of a list of the complete URL’s.

    You’ll also notice two buttons which function to either check all of them or uncheck all of them. Each time something is checked or unchecked (this is handled in two different events because the out-of-the-box CheckedListBox is flakey … in my opinion), those buttons’ .Enabled state will be set:

    I’ll just click to check them all so we can start the test of all files:

    The first part looks familiar from yesterday so needs no description:

    The rest looks the same as yesterday (in fact much of the code was copied verbatim) but there’s one distinct difference. Notice in the following what happens with the CheckedListBox (and the label showing the count) as the files download:

    Then lastly, they all complete:

    I’m not showing the cancel, but I tested it and it works.

    I have the code (a good bit longer now!) on a page of my website here and I hope you find it helpful.

    :)


    Please call me Frank :)

    • Marked as answer by kris914g Tuesday, July 16, 2013 5:54 PM
    • Unmarked as answer by kris914g Friday, July 19, 2013 8:06 PM
    Tuesday, July 16, 2013 5:31 PM
  • that is good work thanks pls can you upload the procjet folder so i can see all the details?
    Tuesday, July 16, 2013 5:54 PM
  • that is good work thanks pls can you upload the procjet folder so i can see all the details?

    Sure. It's here:

    http://www.fls-online.com/VBNet_Forum/07-16-13/Simple_Downloader.zip

    But let me warn you: Unless you use Visual Studio 2008 (and I doubt you do), you won't be able to open it directly. A while back, something changed and it'll show an error when it tries to convert it.

    But don't give up yet!

    Download that zip file to your desktop or somewhere you can easily find because when you're done with what I'll next explain, you'll want to delete the zip file all together. Choose to extract that zip file to your desktop (or wherever) and it will create the project folder and populate it. This can later be deleted also.

    Start a new project (call it whatever you want). It will create Form1.vb and open that up in design view.

    Close that tab and in Solution Explorer, right-click on Form1.vb there and choose to delete that also. I know that sounds crazy but trust me here.

    Now in Solution Explorer, right-click and choose "Add Item >> New Item". Yours may show it differently but look around and you'll find it.

    When you do, browse to Form1.vb in the folder that you extracted and it'll pull in Form1.vb and Form1.Designer.vb along with it.

    Now it should work the way you're used to. Make sure of that and afterward, delete the zip file and the extracted folder.


    Please call me Frank :)


    Tuesday, July 16, 2013 6:06 PM
  • thanks but how can i add downloads in the code i cant find the place
    Tuesday, July 16, 2013 6:17 PM
  • thanks but how can i add downloads in the code i cant find the place

    I don't think we're connecting on this. ;-)

    Can you show me a few of the URL's here?


    Please call me Frank :)

    Tuesday, July 16, 2013 6:20 PM
  • thanks but how can i add downloads in the code i cant find the place

    Kris,

    I'm jumping ahead here but I think I might be right.

    Would I be correct in saying that you don't want to actually show those URL's? You want to show an "alias name" but have the ability that your program can use that alias and then know the actual URL behind it?

    If so, that can be done, but let me know if I'm right and - and if I am - show me a few alias names and their respective URL's and I'll rework it then explain the what and why of it.


    Please call me Frank :)


    Tuesday, July 16, 2013 6:42 PM
  • yea that is what i mean here is some examples

    alieas: Example 1

    url: https://dl.dropboxusercontent.com/u/185853590/Pictures/Example%201.txt

    alieas: Example 2

    Url: https://dl.dropboxusercontent.com/u/185853590/Pictures/Example%202.txt

    alieas: Example 3

    Url: https://dl.dropboxusercontent.com/u/185853590/Pictures/Example%203.txt

    alieas: Example 4

    Url: https://dl.dropboxusercontent.com/u/185853590/Pictures/Example%204.txt

    alieas: Example 5

    Url: https://dl.dropboxusercontent.com/u/185853590/Pictures/Example%205.txt

    Tuesday, July 16, 2013 6:55 PM
  • yea that is what i mean here is some examples

    alieas: Example 1

    url: https://dl.dropboxusercontent.com/u/185853590/Pictures/Example%201.txt

    alieas: Example 2

    Url: https://dl.dropboxusercontent.com/u/185853590/Pictures/Example%202.txt

    alieas: Example 3

    Url: https://dl.dropboxusercontent.com/u/185853590/Pictures/Example%203.txt

    alieas: Example 4

    Url: https://dl.dropboxusercontent.com/u/185853590/Pictures/Example%204.txt

    alieas: Example 5

    Url: https://dl.dropboxusercontent.com/u/185853590/Pictures/Example%205.txt

    Ok I can show you - but where is this data coming from?

    By that I mean -- do you have a text file (i.e., the data may change) or is this to be strictly in code and never exposed to the user?

    One thought here - before we get started on this last part - is to store the data in a file online and have the program 'read it' ... that way it's completely dynamic and you can change it at will without having to recompile (and redistribute) the program.

    Tell me your thoughts please.


    Please call me Frank :)

    Tuesday, July 16, 2013 6:59 PM
  • no its just tests so i can add it self
    Tuesday, July 16, 2013 7:01 PM
  • wait im sorry the urls dosent work i will make some new urls
    Tuesday, July 16, 2013 7:02 PM
  • now i have made some new download links

    (this is just test urls i want to change  it to the real urls myself)

    alias: optifine

    url: https://dl.dropboxusercontent.com/u/185853590/mods/OptiFine_1.5.2_HD_U_D2.zip

    Alias: modloader

    url: https://dl.dropboxusercontent.com/u/185853590/mods/ModLoader.zip

    Alias: Shadersmod

    Url: https://dl.dropboxusercontent.com/u/185853590/mods/ShadersMod-mc1.5.2-ofuD2-1.45.2-ZanderPlays.zip

    Alias: CameraMod

    Url: https://dl.dropboxusercontent.com/u/185853590/mods/CameraStudioV2.8.5%28mc1.5.2%29.zip

    Tuesday, July 16, 2013 7:09 PM
  • oh i forgot The users are not supose to know where the data is coming from
    • Edited by kris914g Tuesday, July 16, 2013 7:22 PM grama fail
    Tuesday, July 16, 2013 7:21 PM
  • oh i forgot The users are not supose to know where the data is coming from

    I've modified it - here's the zip file:

    http://www.fls-online.com/VBNet_Forum/07-16-13/Simple_Downloader_Version3.zip

    Look for a new sub called "InitializeAliasURLs()" and you'll see that it's setting up a new instance of a private class that holds the DisplayName and the actual URL, then storing those in a class-scoped List(Of Class). That's how it's able to match it back up.

    The files are so small I couldn't get many screenshots but it works:

    Try that and let me know please?

    Please call me Frank :)

    Tuesday, July 16, 2013 7:49 PM
  • is it a ftp server you use to make the download list? i want to do it with urls how can i do it with dircet urls?
    Tuesday, July 16, 2013 8:12 PM
  • is it a ftp server you use to make the download list? i want to do it with urls how can i do it with dircet urls?

    No - it's HTTP.

    Did you look at the new set up?

    Private Sub InitializeAliasURLs() aliasList.Clear() Dim thisAlias As New URL_Alias With thisAlias .DisplayName = "optifine" .URL = "https://dl.dropboxusercontent.com/u/185853590/mods/OptiFine_1.5.2_HD_U_D2.zip" End With aliasList.Add(thisAlias) thisAlias = New URL_Alias With thisAlias .DisplayName = "modloader" .URL = "https://dl.dropboxusercontent.com/u/185853590/mods/ModLoader.zip" End With aliasList.Add(thisAlias) thisAlias = New URL_Alias With thisAlias .DisplayName = "Shadersmod" .URL = "https://dl.dropboxusercontent.com/u/185853590/mods/ShadersMod-mc1.5.2-ofuD2-1.45.2-ZanderPlays.zip" End With aliasList.Add(thisAlias) thisAlias = New URL_Alias With thisAlias .DisplayName = "CameraMod" .URL = "https://dl.dropboxusercontent.com/u/185853590/mods/CameraStudioV2.8.5%28mc1.5.2%29.zip" End With aliasList.Add(thisAlias) End Sub


    Those are added to a class-scoped List(Of Class) and that's what's used.

    What made you think it's FTP? I have no idea what the login credentials are to use FTP.


    Please call me Frank :)

    Tuesday, July 16, 2013 8:20 PM

  • The program Visiual Studio don't detect any errors when I debug the program, but when I open it and begin to download something its says that an error occurred: there was an exception during a WebClient request


    Tuesday, July 16, 2013 8:44 PM
  • yea now i can se it in the source code
    Tuesday, July 16, 2013 8:45 PM

  • The program Visiual Studio don't detect any errors when I debug the program, but when I open it and begin to download something its says that an error occurred: there was an exception during a WebClient request


    Did you do like I asked earlier?

    Create a new project and "add existing"?

    If so then I don't know -- it works on my end. The only thing I can suggest is to comment out the Try/Catch and put a breakpoint in to see just exactly what line of code is throwing the Exception and what the Exception is, but it worked here (or I couldn't have created the screenshots).


    Please call me Frank :)

    Tuesday, July 16, 2013 8:49 PM
  •  okay i will try that

    Tuesday, July 16, 2013 8:50 PM
  • "But let me warn you: Unless you use Visual Studio 2008 (and I doubt you do), you won't be able to open it directly."

    I downloaded this project:  http://www.fls-online.com/VBNet_Forum/07-16-13/Simple_Downloader_Version3.zip from your later post.  It opens, upgrades, compiles and runs without intervention or error using VSE2012 for Desktop. 

    Tuesday, July 16, 2013 9:06 PM
  • "But let me warn you: Unless you use Visual Studio 2008 (and I doubt you do), you won't be able to open it directly."

    I downloaded this project:  http://www.fls-online.com/VBNet_Forum/07-16-13/Simple_Downloader_Version3.zip from your later post.  It opens, upgrades, compiles and runs without intervention or error using VSE2012 for Desktop. 

    Ah good then!

    I know for a while (this was with VS2010 though), they'd run into an issue every time trying to open/convert it directly.

    I have no way to know obviously - I only have VS2008.

    Thanks John! :)


    Please call me Frank :)

    Tuesday, July 16, 2013 9:09 PM
  • hmm i still got a error message and cant download files i have maked a new project and add your project as exist project but i still got error message
    Tuesday, July 16, 2013 9:19 PM
  • hmm i still got a error message and cant download files i have maked a new project and add your project as exist project but i still got error message

    The first thing that comes to mind is your firewall. That'll do some weird things by letting parts of it through and not others.

    I can't reproduce it - it worked for me and for John Wein also.

    Here's what I'd do: The BGW (the one for HTTP) is pretty well broken into two sections. Put a breakpoint at the "Try" on the second one and see if it makes it that far. If not, then you know to look in the first one.

    If so, in that first one, comment out the "Try" and the "Catch" (and those lines in that catch) so that in debug mode it will stop when it gets the exception.

    When it does, one of the options will be something about copying the exception to the clipboard (or something like that). Paste that into a text file and have a look - BOTTOM UP - for what it shows. Go to the end and look for something like "vb:line ###" where that line is the line number. Then look at the code on that line number along with the message just above that in the exception.

    That usually gives me a good idea of what happened, but like I said - I can't reproduce it here because it's working (on my end), so really I'm just guessing as much as anything.


    Please call me Frank :)

    Tuesday, July 16, 2013 9:26 PM
  • hmm i still got a error message and cant download files i have maked a new project and add your project as exist project but i still got error message

    Let's try a really simple test.

    Start a new project and in the form's .Load event, put the following:

    Dim url As String = "https://dl.dropboxusercontent.com/u/185853590/mods/OptiFine_1.5.2_HD_U_D2.zip" Dim dt As String = My.Computer.FileSystem.SpecialDirectories.Desktop Dim zipFilePath As String = System.IO.Path.Combine(dt, "testme.zip") Using client As New System.Net.WebClient Dim uri As New Uri(url) client.DownloadFile(uri, zipFilePath) Stop End Using


    You should end up with a zip file on your desktop called "testme.zip"

    Does that work?


    Please call me Frank :)

    Tuesday, July 16, 2013 9:34 PM
  • yea i got the testme file
    Tuesday, July 16, 2013 10:05 PM
  • i dont know what im doing wrong:(
    Tuesday, July 16, 2013 10:05 PM
  • yea i got the testme file

    Well that's good but I'm at a loss as to why the main program isn't working.

    I'll just revert to my former answer: Comment out the Try/Catch and let it fail "in place" in debug mode then see what the exception is and what was being done at the time.

    Do keep in mind that with threading the exception can actually be on the other thread which was triggered as a result of something in the thread that reports the exception.

    I'm not sure if that makes sense or not but comment out the Try and Catch, let it fail, and if nothing else, post the full exception here (not just the message, the whole thing).


    Please call me Frank :)

    Tuesday, July 16, 2013 10:13 PM
  • but where do I add try / catch exactly
    Tuesday, July 16, 2013 10:25 PM
  • but where do I add try / catch exactly

    No, you're confused - they're in the code now. What I was suggesting was to comment them out so that it would fail in place.

    In that BGW's .DoWork event, you'll see this:

    I've highlighted the "Try" on that one. Look on line 714 and let me know if you see it please?


    Please call me Frank :)

    Tuesday, July 16, 2013 10:35 PM
  • yea i can se it in the code
    Wednesday, July 17, 2013 12:19 PM
  • yea i can se it in the code

    Then start by doing this: Put a breakpoint on that line then run the program.

    Do you get the exception before it gets there?


    Please call me Frank :)

    Wednesday, July 17, 2013 12:37 PM
  • oh i have forgot to say the error come then it have downloaded it but i will try to make a breakpoint
    Wednesday, July 17, 2013 12:57 PM
  • oh i have forgot to say the error come then it have downloaded it but i will try to make a breakpoint

    I'm not understanding what you mean.

    Can you step me through the steps of what you do once you run the program and at what point the exception is thrown?


    Please call me Frank :)

    Wednesday, July 17, 2013 1:03 PM
  • okay first i select one a file in the checkboxlist1 then i click download is gonna download until i come to 100% i got the error message: error occurred: there was an exception during a WebClient request
    Wednesday, July 17, 2013 2:54 PM
  • okay first i select one a file in the checkboxlist1 then i click download is gonna download until i come to 100% i got the error message: error occurred: there was an exception during a WebClient request

    Ok then it's in the second half - so at least we know where to look.

    -----

    Before starting the debugging, I'm assuming that you modified the path of where to save it to, right? If you left it as I had it (X:\) and you don't have an X:\, it'll obviously not work. Assuming you've modified the path to something you have, go to this next part:

    -----

    Look on line 769 and you'll see the word "Try":

    Comment that out.

    Now look on line 831 and comment out everything between "Catch" and "End Try", inclusive:

    Now scroll back up to line 770 and put a breakpoint in like I show here:

    Now run the program normally. When the code gets to line 770, it will halt. Step into (not step through) the program line-at-a-time and see where it fails and what the exception message is. You might also want to copy the exception and paste it here (although sometimes it's not very informative, but we can hope).

    A shortcut to stepping into is to press the <F11> key but don't get too far ahead of yourself. Do it one line at a time. Let me know what line it's on when it fails.


    Please call me Frank :)

    Wednesday, July 17, 2013 3:08 PM
  • Just to make sure that the download folder isn't the issue here, I've modified the program to include a button for the user to select it first. Until they select (or create) a folder, the TabControl is disabled:

    I just realized that I should have disabled that button when either of the "Start Download" buttons are clicked, then re-enable it in the respective BGW's .WorkerCompleted event, so please do that in the code, but here's the revised project folder:

    http://www.fls-online.com/VBNet_Forum/07-17-13/Simple_Downloader.zip


    Please call me Frank :)

    Wednesday, July 17, 2013 5:43 PM
  • I take it that you are saving the file to a filesystem which can cope with a 5.5GB file? The limit for FAT32 is 4GB. NTFS and ExFAT will not have a problem with a 5.5GB file.

    --
    Andrew

    Wednesday, July 17, 2013 6:40 PM
  • hey frank i have tryed the new feature you have maked bot got the same error i have not tryed to remove the try/catch i will try it now but i have first noticed that I also get these error files in the project folder https://dl.dropboxusercontent.com/u/185853590/error.rar

    • Edited by kris914g Wednesday, July 17, 2013 8:17 PM forgott link
    Wednesday, July 17, 2013 8:17 PM
  • i have removed the try but there come no error from visual studio just the same error message from windows

    • Edited by kris914g Wednesday, July 17, 2013 8:20 PM gramafail
    Wednesday, July 17, 2013 8:20 PM
  • i have removed the try but there come no error from visual studio just the same error message from windows

    I'm not following what you're seeing or why.

    Can you take a screenshot or something like that? I really don't know how it could work here and with John, but not there.


    Please call me Frank :)

    Wednesday, July 17, 2013 8:24 PM
  • I downloaded http://www.fls-online.com/VBNet_Forum/07-17-13/Simple_Downloader.zip.  Extracted the solution.  Loaded the solution in VSE2012Desktop which upgraded it.  I then double-clicked on the solution file.  I selected a download location and selected all files on the http tab:

    Wednesday, July 17, 2013 8:59 PM
  • John,

    Did they all download ok for you? You didn't say.

    Do you have any thoughts on what he's seeing and what the issue might be? I'm stumped, honestly.

    Thanks


    Please call me Frank :)

    Wednesday, July 17, 2013 9:05 PM
  • "Did they all download ok for you? You didn't say."

    I got an "Operation successful", but I didn't check that they actually downloaded.

    I ran it again and there are four new zip files in my D:\Temp folder.

    Perhaps if the OP did exactly what I did he would get the same result.

    Wednesday, July 17, 2013 9:14 PM
  • "Did they all download ok for you? You didn't say."

    I got an "Operation successful", but I didn't check that they actually downloaded.

    I ran it again and there are four new zip files in my D:\Temp folder.

    Perhaps if the OP did exactly what I did he would get the same result.

    We can hope so, yes.

    Thanks John! :)


    Please call me Frank :)

    Wednesday, July 17, 2013 9:17 PM
  • Thursday, July 18, 2013 12:20 PM
  • i have checked my upgrade.html and i have no errors there i have 1 warning: Simple Downloader.sln: Visual Studio needs to make non-functional changes to this project in order to enable the project to open in this version and Visual Studio 2010 SP1 without impacting project behavior.

    i cant take the screen shots now but i will do i later


    Let it make whatever changes it deems needed. I don't have VS2010 so I don't know.

    Please call me Frank :)

    Thursday, July 18, 2013 12:46 PM
  • okay i will make a video so you can get all the details but my mic dosent work
    Thursday, July 18, 2013 4:00 PM
  • okay i will make a video so you can get all the details but my mic dosent work

    I'll be curious to see what you're up against, so a video would be nice, sure.

    Please call me Frank :)

    Thursday, July 18, 2013 4:03 PM
  • okay but my windows language is danish but i will translate it for you
    Thursday, July 18, 2013 4:23 PM
  • okay now i have made the video

    • Edited by kris914g Thursday, July 18, 2013 5:58 PM url fail
    Thursday, July 18, 2013 5:56 PM
  • okay now i have made the video

    Well I saw that it did throw an exception in that second part.

    The only thing I can suggest is to go back to what I posted yesterday, comment out the Try/Catch like I showed, and run it. Let it fail in debug mode and see if gives you any more information about it.

    It works here - it worked for John - so I don't know honestly. I can't repeat it.


    Please call me Frank :)

    Thursday, July 18, 2013 6:11 PM
  • "okay now i have made the video"

    Download to some place you have permission, not the root of the system drive.

    Thursday, July 18, 2013 6:20 PM
  • "okay now i have made the video"

    Download to some place you have permission, not the root of the system drive.

    You might be on to something John.

    I use XP so I don't always pick up on those things. Directly to the root isn't permitted in Vista/7/8?


    Please call me Frank :)

    Thursday, July 18, 2013 6:23 PM
  • okay i have comment try/catch out and i got a error in visual studio error message: there was an exception during a WebClient request.

    picture

    Thursday, July 18, 2013 6:38 PM
  • if you download the picture you got better quality :) here

    Thursday, July 18, 2013 6:40 PM
  • if you download the picture you got better quality :) here

    If I knew what that said (I only speak English), that might tell me something, but let's try John's recommendation.

    I've modified the code again:

    Try this latest version here:

    http://www.fls-online.com/VBNet_Forum/07-18-13/Simple_Downloader.zip


    Please call me Frank :)

    Thursday, July 18, 2013 6:44 PM
  • the error message is: there was anexceptionduring aWebClientrequest.  same in the program only:there was an exception during a WebClient request.
    Thursday, July 18, 2013 6:47 PM
  • the error message is: there was anexceptionduring aWebClientrequest.  same in the program only:there was an exception during a WebClient request.

    Try that latest version. It won't allow you to select a drive directly - you have to select (or create) a folder on the drive (please be sure it's a safe folder - not something you don't have permission to write to).

    Please call me Frank :)

    Thursday, July 18, 2013 6:51 PM
  • can you just send the program to me to se if I get the error?
    Thursday, July 18, 2013 6:51 PM
  • can you just send the program to me to se if I get the error?

    I did - it's in the link to the zip file a few posts up.

    Please call me Frank :)

    Thursday, July 18, 2013 6:53 PM
  • "can you just send the program to me to se if I get the error?"

    That won't prevent you from selecting a folder that you don't have write permission.  Select your Download folder, for example mine is:  "C:\Users\John\Downloads".

    Thursday, July 18, 2013 7:19 PM
  • "can you just send the program to me to se if I get the error?"

    That won't prevent you from selecting a folder that you don't have write permission.  Select your Download folder, for example mine is:  "C:\Users\John\Downloads".

    John,

    Can you think of a way to know (or test for) a folder which the user doesn't have write permissions to?

    Maybe have a routine to use a small embedded file and attempt to save it to the selected folder or something?


    Please call me Frank :)

    Thursday, July 18, 2013 7:23 PM
  • Can you think of a way to know (or test for) a folder which the user doesn't have write permissions to?
    Dim currPath As String = "C:\"
    Try
        Dim testFile As String = Path.Combine(currPath, "test.tmp")
        File.WriteAllText(testFile, "test")
        File.Delete(testFile)
    Catch ex As Exception
        ' user does not have the needed permissions in currPath 
    End Try

    Looks like it will suffice.

    --
    Andrew

    Thursday, July 18, 2013 7:29 PM
  • Can you think of a way to know (or test for) a folder which the user doesn't have write permissions to?
    Dim currPath As String = "C:\"
    Try
        Dim testFile As String = Path.Combine(currPath, "test.tmp")
        File.WriteAllText(testFile, "test")
        File.Delete(testFile)
    Catch ex As Exception
        ' user does not have the needed permissions in currPath 
    End Try

    Looks like it will suffice.

    --
    Andrew

    I was thinking in terms of a function, but that's the idea.

    Can you think of a drawback to this Andrew?


    Please call me Frank :)

    Thursday, July 18, 2013 7:31 PM
  • I was thinking in terms of a function, but that's the idea.

    Can you think of a drawback to this Andrew?

    Well, that code could easily be wrapped as a function of course.

    Drawback? Are you suggesting there is something possible like the user has managed to make the directory write-only <shudder and lol />?

    --
    Andrew


    Thursday, July 18, 2013 7:36 PM
  • Well, that code could easily be wrapped as a function of course.

    Drawback? Are you suggesting there is something possible like the user has managed to make the directory write-only <shudder and lol />?

    --
    Andrew


    If they did, this function would catch that too - but I was just thinking that this so simple ... why are we the first ones to even talk about it (to my knowledge)?

    Seems there's a ghost lurking! ;-)

    I think I'll do that though - I can't think of anything wrong. I don't *think* it would backfire, or I don't see how [yet].


    Please call me Frank :)

    Thursday, July 18, 2013 7:41 PM
  • This is what I came up with:

    #Region "Select Download Folder"

        
    Private Sub btn_SelectFolder_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) _
            
    Handles btn_SelectFolder.Click

        
    Using fbd As New FolderBrowserDialog
          
    With fbd
            .Description = 
    "Select (Or Create) The Folder To Download The Files To"
            .RootFolder = 
    Environment.SpecialFolder.MyComputer
            .ShowNewFolderButton = 
    True
          
    End With

          
    Do
            
    If fbd.ShowDialog = Windows.Forms.DialogResult.OK Then
              downloadFolder = fbd.SelectedPath
              
    Dim testFile As String = IO.Path.Combine(downloadFolder, "TestFile.txt")
              
    Try
                IO.
    File.WriteAllText(testFile, "Testing for valid download folder.")
              
    Catch ex As Exception
                
    MessageBox.Show("You don't have write permission for the selected folder.  Select another folder.")
                
    Continue Do
              
    End Try
              IO.
    File.Delete(testFile)
              CheckOkToProceed()
              
    Exit Do
            
    Else
              
    Exit Do
            
    End If
          
    Loop
        
    End Using

        
    End Sub

    Thursday, July 18, 2013 7:51 PM
  • This is what I came up with:

    <snip>

             Try
                IO.
    File.WriteAllText(testFile, "Testing for valid download folder.")
              
    Catch ex As Exception
                
    MessageBox.Show("You don't have write permission for the selected folder.  Select another folder.")
                
    Continue Do
              
    End Try
              IO.
    File.Delete(testFile)
    <snip>

    I'd delete the file in the Try part, otherwise you could get a File Not Found exception for the File.Delete. Also, I'd give the file a .tmp extension, as it is only a temporary file and that would give disk cleanup a hint that the file can be deleted.

    --
    Andrew

    Thursday, July 18, 2013 7:55 PM
  • Thanks John.

    :)


    Please call me Frank :)

    Thursday, July 18, 2013 8:00 PM
  • This is what I came up with:

    <snip>

             Try
                IO.
    File.WriteAllText(testFile, "Testing for valid download folder.")
              
    Catch ex As Exception
                
    MessageBox.Show("You don't have write permission for the selected folder.  Select another folder.")
                
    Continue Do
              
    End Try
              IO.
    File.Delete(testFile)
    <snip>

    I'd delete the file in the Try part, otherwise you could get a File Not Found exception for the File.Delete. Also, I'd give the file a .tmp extension, as it is only a temporary file and that would give disk cleanup a hint that the file can be deleted.

    --
    Andrew

    If the directory can't be written to - the file doesn't exist, or am I missing something? What do you think about this:

    ''' <summary> ''' This function will return a boolean indicating whether or not the folder can be written to. ''' </summary> ''' <param name="fldr">The full path of the directory (folder).</param> ''' <returns></returns> ''' <remarks></remarks> Private Function FolderCanBeWrittenTo(ByVal fldr As String) As Boolean Dim retVal As Boolean = True Try If My.Computer.FileSystem.DirectoryExists(fldr) Then Dim testPath As String = Combine(fldr, "Test.txt") My.Computer.FileSystem.WriteAllText(testPath, "test", False) My.Computer.FileSystem.DeleteFile(testPath) Else Throw New Exception("Directory Does Not Exist.") End If Catch ex As Exception retVal = False End Try Return retVal End Function


    If you're running something higher than XP (what I have), would you test it? I have no way to do that.


    Please call me Frank :)

    Thursday, July 18, 2013 8:02 PM
  • "I'd delete the file in the Try part, otherwise you could get a File Not Found exception for the File.Delete"

    Please explain how it is possible to get a "File Not Found" exception in the code I posted.

    "I'd give the file a .tmp extension, as it is only a temporary file and that would give disk cleanup a hint that the file can be deleted."

    That's fine, but it would take an unusual circumstance for the file to remain after the code executes.  But I agree .tmp is a better extension than .txt.

    Thursday, July 18, 2013 8:04 PM
  • "I'd delete the file in the Try part, otherwise you could get a File Not Found exception for the File.Delete"

    Please explain how it is possible to get a "File Not Found" exception in the code I posted.

    "I'd give the file a .tmp extension, as it is only a temporary file and that would give disk cleanup a hint that the file can be deleted."

    That's fine, but it would take an unusual circumstance for the file to remain after the code executes.  But I agree .tmp is a better extension than .txt.

    John,

    If the folder (directory) cannot be written to - then how can there be a file to delete??


    Please call me Frank :)

    Thursday, July 18, 2013 8:09 PM
  • Please explain how it is possible to get a "File Not Found" exception in the code I posted.

    My mistake: I thought (assumption is the mother of all something-or-other :) that if access is not allowed then it would throw an exception. I tested deleting a non-existent file in a directory to which I specifically denied myself any access at all and it did not throw an exception. Then I had fun giving the access back to myself to delete that directory.

    Anyway, I think it looks tidier to delete the file on the next line rather than try to do it regardless of whether or not the file was created. Yes... that's my excuse, and I'm sticking to it :)

    --
    Andrew

    Thursday, July 18, 2013 8:16 PM
  • "John,

    If the folder (directory) cannot be written to - then how can there be a file to delete??"

    How does the code try to delete a file that doesn't exist?

    If the folder (directory) cannot be written to, an exception is thrown.  There is no code in this path that tries to delete a file.

    Thursday, July 18, 2013 8:18 PM
  • "I think it looks tidier to delete the file on the next line rather than try to do it regardless of whether or not the file was created."

    I don't see how the code I posted tries to delete a file that wasn't created.

    Thursday, July 18, 2013 8:23 PM
  • I don't see how the code I posted tries to delete a file that wasn't created.

    The IO.File.Delete in your code is outside the Try..Catch structure wherein the file was (attempted to be) created.

    --
    Andrew

    Thursday, July 18, 2013 8:28 PM
  • Kris,

    Anyway, back to the matter at hand, I've updated the program again and it's here.

    I've added this when the user selects a folder:

    Private Sub btn_SelectFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles btn_SelectFolder.Click Using fbd As New FolderBrowserDialog With fbd .Description = "Select (Or Create) The Folder To Download The Files To" .RootFolder = Environment.SpecialFolder.MyComputer .ShowNewFolderButton = True End With If fbd.ShowDialog = Windows.Forms.DialogResult.OK Then If FolderCanBeWrittenTo(fbd.SelectedPath) Then downloadFolder = fbd.SelectedPath CheckOkToProceed() Else Dim sb As New System.Text.StringBuilder sb.AppendLine("The folder path which you have selected:") sb.AppendLine() sb.AppendLine() sb.AppendLine(fbd.SelectedPath) sb.AppendLine() sb.AppendLine() sb.AppendLine("Cannot be used because you do not have permission") sb.AppendLine("to write to this path.") sb.AppendLine() sb.AppendLine() sb.AppendLine("Please select a folder path which you have permission") sb.AppendLine("to write to.") MessageBox.Show(sb.ToString, "Unable To Use Your Selected Folder", _ MessageBoxButtons.OK, MessageBoxIcon.Warning) btn_SelectFolder_Click(Nothing, Nothing) End If End If End Using End Sub


    The function that refers to is here:

    ''' <summary> ''' This function will return a boolean indicating whether or not the folder can be written to. ''' </summary> ''' <param name="fldr">The full path of the directory (folder).</param> ''' <returns></returns> ''' <remarks></remarks> Private Function FolderCanBeWrittenTo(ByVal fldr As String) As Boolean Dim retVal As Boolean = True Try Dim testPath As String = Combine(fldr, "Test.tmp") My.Computer.FileSystem.WriteAllText(testPath, "test", False) If My.Computer.FileSystem.FileExists(testPath) Then My.Computer.FileSystem.DeleteFile(testPath) End If Catch ex As Exception retVal = False End Try Return retVal End Function


    Unfortunately I have no way to test that function, but do please let me know your results. 


    Please call me Frank :)

    Thursday, July 18, 2013 8:34 PM
  • "The IO.File.Delete in your code is outside the Try..Catch structure wherein the file was (attempted to be) created"

    Are you saying that a Try...Catch structure can be bypassed?  I wrote the code assuming that as least the first statement in the Try block would always be executed.  If the file is created, the next statement deletes it.  If the file isn't created the next statement tells the user to try again.  Under what circumstances can the file not be created and the file delete statement executed.

    Thursday, July 18, 2013 8:53 PM
  • Under what circumstances can the file not be created and the file delete statement executed.

    You're exactly right - if the folder cannot be written to, the file will not exist.

    I have no way to test that, but it only makes sense.


    Please call me Frank :)

    Thursday, July 18, 2013 8:58 PM
  • Aside from all this. 

    Try downloading to a folder without write permission (using your original code).  You'll get the same result as the OP.

    Thursday, July 18, 2013 9:09 PM
  • Aside from all this. 

    Try downloading to a folder without write permission (using your original code).  You'll get the same result as the OP.

    Using a FolderBrowserDialog, I can't reach anything that's inherently protected.

    Can you try that latest version and let me know if the function works properly? I'm on XP. I might can get my daughter to try it on 7 sometime this weekend, but I don't know of a way to do it unless I bypass the changes.


    Please call me Frank :)

    Thursday, July 18, 2013 9:15 PM
  • I don't see how the code I posted tries to delete a file that wasn't created.

    Ohhh... silly me... the multiple Exit/Continue Do does not make it obvious at first glance for me.

    Sorry,

    Andrew

    Thursday, July 18, 2013 9:27 PM
  • hi all'm sorry but going on vacation for 2 weeks where I did not have the opportunity to get to the Internet
    Friday, July 19, 2013 3:51 PM
  • okay no it works but then im trying to add a homevideo there have 5,5gb i got the same error message but then i download the test files i works
    Friday, July 19, 2013 5:01 PM
  • okay no it works but then im trying to add a homevideo there have 5,5gb i got the same error message but then i download the test files i works

    That might be now due to what Andrew brought up about your drive format. I've never tried to download/upload a file that size (I'm on a 32-bit system anyway), so I don't know, but at least the program itself is working.

    You might do this: Put a breakpoint in the Catch. When it gets there, hover your mouse over "ex" and you can examine the actual exception. See if it might be pointing to something about the file's size or the target or anything like that.

    *****

    Have you tried downloading it another way and does that work? If so, what way are you using and was it successful?


    Please call me Frank :)

    Friday, July 19, 2013 5:07 PM
  • i have downloading it another way and i works but i cant download the big file i dont wont to share my home video but i have another link with 5 gb we can test with: here is a 5gb

    its a wow private server client if you want to know that is just so we can test

    Friday, July 19, 2013 6:36 PM
  • i have downloading it another way and i works but i cant download the big file i dont wont to share my home video but i have another link with 5 gb we can test with: here is a 5gb

    its a wow private server client if you want to know that is just so we can test


    Did you investigate what the exception is that's preventing it from downloading?

    Please call me Frank :)

    Friday, July 19, 2013 6:40 PM
  • no it just comes with the same error as in the video I made
    but I can download other files :)
    Friday, July 19, 2013 6:54 PM
  • i have downloading it another way and i works but i cant download the big file i dont wont to share my home video but i have another link with 5 gb we can test with: here is a 5gb

    its a wow private server client if you want to know that is just so we can test

    I did what I suggested to you to do and it's reporting "illegal characters in the path".

    That question mark in the URL is what I'm betting the problem is. I never considered that - let me mull it over a bit.


    Please call me Frank :)

    Friday, July 19, 2013 6:55 PM
  • okay but can not get it to allow ? in the url?
    Friday, July 19, 2013 6:59 PM
  • okay but can not get it to allow ? in the url?

    It's not the URL, it's the local file name that's the issue.

    Try this latest version:

    http://www.fls-online.com/VBNet_Forum/07-19-13/Simple_Downloader.zip

    I used this method (from System.IO.Path) to get a list of invalid characters and, if any are found, they're replaced with an underscore.

    Try this one ... and now do remember all the way back to what I said about using the synchronous method, the display will be somewhat disappointing.


    Please call me Frank :)

    Friday, July 19, 2013 7:12 PM
  • now it works thanks but can we add how much mb you have downloaded at the file?
    Friday, July 19, 2013 7:28 PM
  • and remove the links in the download details?
    Friday, July 19, 2013 7:28 PM
  • and download speed
    Friday, July 19, 2013 7:31 PM
  • now it works thanks but can we add how much mb you have downloaded at the file?

    You can't - that's what I meant about using the synchronous method and what I pointed out (before I started this) about it being disappointing.

    If you want to - and you try this one on your own - you might put a timer on the main UI and have it look every one second for the value of the the local file size (that wouldn't work the other way around).

    In order to do that though, you'll have to have a class-scoped variable that knows the full path of where it's currently being downloaded to.

    A better way is asynch, like we talked about several days ago, but it gets difficult when downloading (or uploading) multiples to prevent the asynch method from starting up multiple instances one right after another. I've done it - and may again - but that's not what this is.


    Please call me Frank :)

    Friday, July 19, 2013 7:32 PM
  • and remove the links in the download details?

    I don't know what you're talking about there, but overall - the program does as I said it would five days ago. It's working per design.

    It's a synchronous method - it will only see something to report AFTER the current one has downloaded.

    I said before I started that the display will be "disappointing".


    Please call me Frank :)

    Friday, July 19, 2013 7:35 PM
  • okay but can you try to make it asynch in the simple downloader or is it too hard?
    Friday, July 19, 2013 7:39 PM
  • okay but can you try to make it asynch in the simple downloader or is it too hard?

    Maybe some day ...

    Please call me Frank :)

    Friday, July 19, 2013 7:41 PM
  • okay tomorrow I go on a 2 week vacation so you do not have to hurry if you bother
    Friday, July 19, 2013 7:44 PM
  • okay tomorrow I go on a 2 week vacation so you do not have to hurry if you bother

    This thread is long enough. I told you five days ago what to expect; it's doing what I "advertised" that it would.

    El Fin


    Please call me Frank :)

    Friday, July 19, 2013 7:47 PM
  • I have also discovered that progress bar, and percentage text does not work on the large file. i have downloaded 500MB with the program but it still remains at 0.0 percent, and the progress bar has Marquee style so i can not see it  i can only see it because I checkkker on the downloaded file's properties but only with the large file.
    Friday, July 19, 2013 7:50 PM
  • I have also discovered that progress bar, and percentage text does not work on the large file. i have downloaded 500MB with the program but it still remains at 0.0 percent, and the progress bar has Marquee style so i can not see it  i can only see it because I checkkker on the downloaded file's properties but only with the large file.

    BY DESIGN Kris,

    Look at the code. The synchronous method is a blocking call - so the program cannot report progress on anything until AFTER a file has been downloaded, then it looks at the history and makes the calculations. Until then, it has no idea what's going on.

    This is what I expected and what I said five days ago.

    If you're truly disappointed with the outcome then by all means UNMARK ME AS THE ANSWERER!

    I'll be offline for several hours either way ... but it's doing what I said it would do almost a week ago now.

    I'm done with this thread now and I've only ever said that one other time.


    Please call me Frank :)

    • Marked as answer by kris914g Friday, July 19, 2013 8:09 PM
    Friday, July 19, 2013 7:55 PM

  • thanks for the help I could not do it without you
    Friday, July 19, 2013 8:09 PM
  • thanks for the help I could not do it without you

    Kris,

    I'll go back on my word; I'm not done with this thread yet.

    I still have a long way to go, but when you get back, you'll have what you want: The program will now download multiple files using the asynch method and will report progress along the way:

    It'll be several days completing it (to do what I want) and then explaining it will take a while in itself.

    Nonetheless ... you'll have what you want in the end. :)


    Please call me Frank :)

    Sunday, July 21, 2013 9:36 PM

  • thanks for the help I could not do it without you

    Have a look at a post I just put here:

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/58ef7344-98ac-4b32-9a46-ce218bda3df8/downloading-files

    I hope you find it helpful. :)


    Please call me Frank :)

    Wednesday, July 24, 2013 7:21 PM
  • yea its very helpfully thanks for the link
    Sunday, August 04, 2013 6:05 PM