Hello Everyone,I'm new at DaniWeb
I have a problem with my file download function.
This's my function
Private Function download_files(ByVal _URL As System.Uri, ByVal _SaveAs As String)
If InternetConnection() = True Then
Dim _WebClient As New System.Net.WebClient()
Try
AddHandler _WebClient.DownloadProgressChanged, AddressOf _DownloadProgressChanged
lblStatus.Text = "Downloading File :" & _SaveAs
_WebClient.DownloadFileAsync(_URL, _SaveAs)
Return True
Catch ex As Exception
_WebClient = Nothing
Return False
lblStatus.Text = "Güncelleme Sunucusuna Bağlantı Başarısız Oldu."
End Try
Else
lblStatus.Text = "Güncelleme Sunucusuna Bağlantı Başarısız Oldu."
End If
End Function
And this's my download loop
Private Sub download()
Dim x As Integer
For x = 0 To lstUrlsToDownload.Items.Count - 1
download_files(New Uri(lstUrlsToDownload.Items.Item(x).ToString), "c:\" & lstFilesToDownload.Items.Item(x).ToString)
Next
End Sub
In lstUrlsToDownload i have url's for example
http://www.sth.com/sth.txt
http://www.abc.com/abc.txt
In lstFilesToDownload i have file names in the same order as urls for example
sth.txt
abc.txt
My problem is with my loop all files downloading at the same time but i want to download them one by one one will finish and other will start and goes like that how can i do that thanks so much good forums to everyone