Downloads a file or page html using a usercontrols async method, read about it here,
http://msdn.microsoft.com/library/de...hasyncread.asp
Printable View
Downloads a file or page html using a usercontrols async method, read about it here,
http://msdn.microsoft.com/library/de...hasyncread.asp
Heres the one I made earlier, just never got around to post it. Its slightly different than yours. I only got around to make it download txt, though downloading a file woulden't take much editing if they look at your example. Mine also out-sourced the AsyncReadComplete with a Event HTMLComplete on the form
@Jmacp,
Is it possible to modify your code to get the download speed of the file?
Edit:
This works!
vb Code:
Private Sub UserControl_AsyncReadProgress(AsyncProp As AsyncProperty) On Error Resume Next picAsyncReadDownload.ScaleWidth = AsyncProp.BytesMax On Error GoTo 0 lblProgress.Width = AsyncProp.BytesRead lblPercent.Caption = Int((AsyncProp.BytesRead / picAsyncReadDownload.ScaleWidth) * 100) & "%" 'Data transfer rate Form1.Label5.Caption = Format(AsyncProp.BytesRead / (1024 * sw.ElapsedSeconds), "00.00") If CSng(Form1.Label5.Caption) <> 0 Then 'Estimated Time Remaing Form1.Label8.Caption = Format(((AsyncProp.BytesMax - AsyncProp.BytesRead) / 1024) / CSng(Form1.Label5.Caption), "00.00") & " Secs." End If Form1.Label5.Caption = Form1.Label5.Caption & " KB/Sec" Form1.Label6.Caption = Int((AsyncProp.BytesRead / picAsyncReadDownload.ScaleWidth) * 100) & "%" End Sub
Here is the original thread the code comes from.