Private Sub Form_Load()
Dim tmp() As String
Dim i As Integer
Open App.Path & "\links.txt" For Input As #1
    tmp() = Split(Input(LOF(1), 1), vbCrLf)
Close #1
For i = 0 To UBound(tmp)
DL.Download tmp(i), App.Path & "\" & ExtractFileName(tmp(i)), "k" & i
Label2.Caption = "Connecting..."
Next i
End Sub

Private Function ExtractFileName(ByVal vStrFullPath As String) As String
   Dim intPos As Integer
   intPos = InStrRev(vStrFullPath, "/")
   ExtractFileName = Mid$(vStrFullPath, intPos + 1)
End Function

The Problem is that I put about 4 links in the text file, and when I run the application it downloads them all at once, I would like it if it downloads them one at a time and about 2 minutes delay between downloading, so when one file is downloaded it will then wait 2 minutes then start downloading the next.

Write this code in the declaration section:

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Then suppose you want a delay of 2 minutes, then convert it into milliseconds, i.e. 120000.

Sleep(120000)

i dont understand :s

My post shows you one way to introduce those 2-minute delays that you want.

any other way :)?

Well, I've used it this way. No other ideas.

so, where abouts do I put it in,

Private Sub Form_Load()
Dim tmp() As String
Dim i As Integer
Open App.Path & "\links.txt" For Input As #1
tmp() = Split(Input(LOF(1), 1), vbCrLf)
Close #1
For i = 0 To UBound(tmp)
DL.Download tmp(i), App.Path & "\" & ExtractFileName(tmp(i)), "k" & i
Label2.Caption = "Connecting..."
Next i
End Sub

Private Function ExtractFileName(ByVal vStrFullPath As String) As String
Dim intPos As Integer
intPos = InStrRev(vStrFullPath, "/")
ExtractFileName = Mid$(vStrFullPath, intPos + 1)
End Function

Private Sub Form_Load()
Dim tmp() As String
Dim i As Integer
Open App.Path & "\links.txt" For Input As #1
    tmp() = Split(Input(LOF(1), 1), vbCrLf)
Close #1
For i = 0 To UBound(tmp)
DL.Download tmp(i), App.Path & "\" & ExtractFileName(tmp(i)), "k" & i
Label2.Caption = "Connecting..."
Next i
End Sub

Private Function ExtractFileName(ByVal vStrFullPath As String) As String
   Dim intPos As Integer
   intPos = InStrRev(vStrFullPath, "/")
   ExtractFileName = Mid$(vStrFullPath, intPos + 1)
End Function

The Problem is that I put about 4 links in the text file, and when I run the application it downloads them all at once, I would like it if it downloads them one at a time and about 2 minutes delay between downloading, so when one file is downloaded it will then wait 2 minutes then start downloading the next.

Hi,
Sleep () helps you to give the delay.
1000 milliseconds represent one Second
so for 2 minutes 1000 * 60 * 2 = 120000
Declare the Sleep() at the Top. Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Form_Load()
Dim tmp() As String
Dim i As Integer
Open App.Path & "\links.txt" For Input As #1
    tmp() = Split(Input(LOF(1), 1), vbCrLf)
Close #1
For i = 0 To UBound(tmp)
DL.Download tmp(i), App.Path & "\" & ExtractFileName(tmp(i)), "k" & i
Label2.Caption = "Connecting..."
[B]Call Sleep ( 120000 )[/B]
Next i
End Sub

Private Function ExtractFileName(ByVal vStrFullPath As String) As String
   Dim intPos As Integer
   intPos = InStrRev(vStrFullPath, "/")
   ExtractFileName = Mid$(vStrFullPath, intPos + 1)
End Function

Note:
Until 2 minutes complete, your program will be idle, even u cannot maximize,minimise and moving.It wont receive any input. Using Timer may be the good solution.

Using Timer may be the good solution.

Agreed. That is more practicable for such long delays.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.