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.IOEx ception' 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\ap pupdate.zip",
FileMode.Create )
m_resp.GetRespo nseStream().Beg inRead(datBuffe r, 0, pktSize, New
AsyncCallback(A ddressOf On_datRead), frmSync)
[some more code skipped]
End Sub
Shared Sub On_datRead(ByVa l res As IAsyncResult)
Dim pktBytes As Integer = m_resp.GetRespo nseStream().End Read(res)
m_fs.Write(datB uffer, 0, pktBytes)
pbrSync.Value = pbrSync.Value + pktBytes
Application.DoE vents()
If pktBytes > 0 Then
m_resp.GetRespo nseStream().Beg inRead(datBuffe r, 0, pktSize,
New AsyncCallback(A ddressOf On_datRead), frmSync)
Else:
m_fs.Close()
m_fs = Nothing
End If
End Sub
End Class
"Loane Sharp" <lo********@hot mail.com> wrote in message
news:eF******** ******@tk2msftn gp13.phx.gbl...
Hi there
I'm currently using WebClient.Downl oadFile 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