I use the below code when downloading using Inet1 and i want to get the kb/s for the download. With the code i am getting the kb but how would i get the speed?

Timer? code?

Any ideas?

VB Code:
  1. Private Sub Inet1_StateChanged(ByVal state As Integer)
  2. Dim vtData As Variant
  3. Dim strFileName As String
  4. Dim lngLength As Long
  5.  
  6. Select Case state
  7. Case icResponseCompleted
  8. Dim bDone As Boolean: bDone = False
  9. Dim tempArray() As Byte
  10.  
  11. strFileName = txtSavePath.Text & lstDownload.Text
  12. Open strFileName For Binary Access Write As #1
  13. vtData = Inet1.GetChunk(1024, icByteArray)
  14. DoEvents
  15. If Len(vtData) = 0 Then
  16. bDone = True
  17. End If
  18.  
  19. Do While Not bDone
  20. tempArray = vtData
  21. Put #1, , tempArray
  22.  
  23. vtData = Inet1.GetChunk(1024, icByteArray)
  24. DoEvents
  25. lngLength = lngLength + 1024 \ 1024
  26. lblBytes.Caption = "Progress: " & lngLength & "kb"
  27.  
  28.  
  29. If Len(vtData) = 0 Then
  30. bDone = True
  31. End If
  32. Loop
  33.  
  34. Close #1
  35. End Select
  36.  
  37. End Sub