Net Grab Test


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 * 8) / 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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s