Results 1 to 7 of 7

Thread: Downloader

  1. #1

    Thread Starter
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    Arrow Downloader

    Hi all,

    Need some help from you ppl. I want to develope a downloader program, where I can queue number of files to be downloaded from the web. I have got a following function, which I use to download individual file from the web:

    VB Code:
    1. Public Function DownloadFile(ByVal URL As String, ByVal LocalFileName As String) As Boolean
    2.         Dim myClient As New System.Net.WebClient
    3.         Dim S As System.IO.FileStream
    4.         Dim myBuffer As Byte()
    5.         Try
    6.             myBuffer = myClient.DownloadData(URL)
    7.             S = New IO.FileStream(LocalFileName, IO.FileMode.OpenOrCreate)
    8.             S.Write(myBuffer, 0, myBuffer.Length)
    9.             S.Flush()
    10.         Catch
    11.  
    12.         Finally
    13.             If Not S Is Nothing Then S.Close()
    14.             myClient.Dispose()
    15.  
    16.         End Try
    17.         If Not myBuffer Is Nothing Then Return True
    18.     End Function

    This function is working fine, but the problem with using this function for multiple downloads are:

    1. I cannot terminate the downloading process inbetween.
    2. Cant show a progress bar while downloading.
    3. There are various URLs which have asp or php path, wherein giving a destination path is troublesome.

    Pls pass on your suggestions and ideas.

    Cheers n Regards

  2. #2
    Addicted Member
    Join Date
    Jan 2005
    Location
    Montréal
    Posts
    160

    Re: Downloader

    1. I cannot terminate the downloading process inbetween.
    Sure you can, start the download function in a separate thread.
    There are no stupid questions, but a whole bunch of dumb sayings !

    Save time on database code, try DataLG !

  3. #3

    Thread Starter
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    Re: Downloader

    Can you give me a sample code please. Never done threading!!

  4. #4
    Addicted Member
    Join Date
    Jan 2005
    Location
    Montréal
    Posts
    160

    Re: Downloader

    There are no stupid questions, but a whole bunch of dumb sayings !

    Save time on database code, try DataLG !

  5. #5

    Thread Starter
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    Re: Downloader

    Thats cool...will go thru it. What abt other queries? You have any better solution to dload multiple files?

  6. #6
    Hyperactive Member
    Join Date
    Mar 2005
    Posts
    312

    Re: Downloader

    Threading is the solution to your 2nd problem as well however i am not sure about the 3rd one.
    I have made a Download Manager through Threading and it is very easy using Threads.Also u can use the Threads for showing the Progress bar and terminating the Download in Between.

    Please tell me the Solution of your 3rd question if u find it anywhere.

  7. #7

    Thread Starter
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    Re: Downloader

    How would u increament the progress bar?

    One more question? I am displaying the list of downloads on the flexigrid. How to insert progress bar in the flexi grid for each download?

    thanx in advance

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