Hi H
Thank you for pointing me in the right direction. I have one small question
.... Why do I get the following error message from the JIT debugger? "An
exception 'System.IO.IOException' has occurred in synchronize.exe".
My code (a bit abbreviated) is as follows ...
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.IO
Imports System.Net
Public Class synchronize
Inherits System.Windows.Forms.Form
Shared frmSync As Form
Shared WithEvents btn As Button
Shared lblInfo As Label
Shared pbrSync As ProgressBar
Shared res_App, res_Dat, res_Cht, cdr_Fisheye, cdr_FisheyeTemp,
emp_FisheyeTemp As Integer
Shared len_App, len_Dat, len_Cht As Double
Shared datBuffer() As Byte
Const pktSize As Integer = 65536
Shared m_resp As HttpWebResponse
Shared m_fs As FileStream
Shared Sub Main()
Application.Run(New synchronize())
End Sub
Public Sub New()
frmSync = New Form()
[some other code skipped]
m_fs = New FileStream("C:\Fisheye\temp\appupdate.zip",
FileMode.Create)
m_resp.GetResponseStream().BeginRead(datBuffer, 0, pktSize, New
AsyncCallback(AddressOf On_datRead), frmSync)
[some more code skipped]
End Sub
Shared Sub On_datRead(ByVal res As IAsyncResult)
Dim pktBytes As Integer = m_resp.GetResponseStream().EndRead(res)
m_fs.Write(datBuffer, 0, pktBytes)
pbrSync.Value = pbrSync.Value + pktBytes
Application.DoEvents()
If pktBytes > 0 Then
m_resp.GetResponseStream().BeginRead(datBuffer, 0, pktSize,
New AsyncCallback(AddressOf On_datRead), frmSync)
Else:
m_fs.Close()
m_fs = Nothing
End If
End Sub
End Class
"Loane Sharp" <lo********@hotmail.com> wrote in message
news:eF**************@tk2msftngp13.phx.gbl...
Hi there
I'm currently using WebClient.DownloadFile to download a file from the
server to my local disk. Is there a way to show the progress of the file
download?
Best regards
Loane