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