Net Grab Test
May 9, 2008
Option Explicit
Private Sub Command1_Click()
Text2.Text = “”
NetGrab1.DownloadStart Trim$(Text1.Text), vbAsyncReadForceUpdate
End Sub
Private Sub Form_Load()
Text1.Text = “http://www.yahoo.com/samples“
Text2.Text = “”
Label2.Caption = “”
End Sub
Private Sub NetGrab1_DownloadComplete(ByVal nBytes As Long)
Dim Kbps As Double
With NetGrab1
If optType(0).Value Then
Text2.Text = StrConv(.Bytes, vbUnicode)
End If
Kbps = ((nBytes *
/ 1000) / (.Duration / 1000)
Label2.Caption = Format$(nBytes, “#,##0″) & ” bytes (” & _
Format$(Kbps, “0.0″) & ” kbps)”
End With
End Sub
Private Sub NetGrab1_DownloadFailed(ByVal ErrNum As Long, ByVal ErrDesc As String)
Debug.Print “WaaahhhhhH!”, ErrDesc
End Sub
Private Sub NetGrab1_DownloadProgress(ByVal nBytes As Long)
‘ This will never fire in VB5…
Debug.Print “Progress: “; nBytes
End Sub
Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub