So I want to download two or more files from a list asynchronously
I have to code below
Public Sub Download()
Dim manifests = "1.manifest,2.manifest,3.manifest"
Dim remote_folder = "root\manifests"
Dim manifestlist As New List(Of String)
Dim splitit As String() = Split(manifests, ",")
For Each Split As String In splitit
manifestlist.Add(Split)
Next
For Each Data As String In manifestlist
Dim result As IAsyncResult = FTP.BeginDownload(remote_folder & "\" & Data, Application.StartupPath & "\dl", TraversalMode.Recursive, TransferMethod.Copy, ActionOnExistingFiles.OverwriteDifferentSize, New AsyncCallback(AddressOf Finish), Nothing)
Next
End Sub
Private Sub Finish(ByVal result As IAsyncResult)
Msgbox("Done adding manifests")
End Sub
So the method should download files one by one, but this way it will download all files at same time.
I want it to download first file, wait for finish, then second file and again wait for finish and as soon as last file is done, it should get the Finish sub.
Any idea on this one?