Sub Button1_Click
downloaderror = False
downloadfile = 1
label1.Text = "Download Start"
downloadstart
End Sub
Sub downloadstart
Dim job1 As HttpJob
job1.Initialize("job1", Me)
job1.Download("somelink" & downloadfile & ".txt")
End Sub
Sub JobDone (job As HttpJob)
If job.Success Then
Dim out As OutputStream
out = File.OpenOutput(File.DirDocuments, downloadfile & ".txt",False)
File.Copy2(job.GetInputStream, out)
out.Close
Else
label1.Text = "Error: " & job.ErrorMessage
downloaderror = True
End If
job.Release
If downloaderror = False And downloadfile < 1000 Then
downloadfile = downloadfile + 1
downloadstart
End If