S
scorpion53061
this code came from cor and I think Armin authored it.
I am trying to download an access database and track its progress.
It is reading the size fo the file but I am unsure of how to get the data
there. It is not actually writing anything.
Any ideas anyone?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ipserver = "xx.xx.xx.xx"
m_Thread = New MyThread
AddHandler m_Thread.Progress, AddressOf OnProgress
AddHandler m_Thread.Done, AddressOf OnDone
m_Thread.Start()
End Sub
Public Delegate Sub ProgressDelegate(ByVal Progress As Integer)
Private Sub OnProgress(ByVal Progress As Integer)
If Me.InvokeRequired Then
Me.Invoke(New ProgressDelegate( _
AddressOf OnProgress _
), New Object() {Progress})
Else
Me.Button1.Text = Progress.ToString
ProgressBar1.Increment(1)
End If
End Sub
Private Sub OnDone()
m_Thread = Nothing
End Sub
Class MyThread
Public Event Progress(ByVal Progress As Integer)
Public Event Done()
Private m_Thread As Thread
Public Sub Start()
m_Thread = New Thread(AddressOf ThreadStart)
m_Thread.Start()
End Sub
Private Sub ThreadStart()
Dim i As Integer
With keywordwebrequest.GetRequestStream
For i = 1 To keywordresponsesize / 50000
'(keywordwebrequest.GetRequestStream.Write
Thread.Sleep(100)
RaiseEvent Progress(i)
Next
End With
RaiseEvent Done()
End Sub
End Class
I am trying to download an access database and track its progress.
It is reading the size fo the file but I am unsure of how to get the data
there. It is not actually writing anything.
Any ideas anyone?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ipserver = "xx.xx.xx.xx"
m_Thread = New MyThread
AddHandler m_Thread.Progress, AddressOf OnProgress
AddHandler m_Thread.Done, AddressOf OnDone
m_Thread.Start()
End Sub
Public Delegate Sub ProgressDelegate(ByVal Progress As Integer)
Private Sub OnProgress(ByVal Progress As Integer)
If Me.InvokeRequired Then
Me.Invoke(New ProgressDelegate( _
AddressOf OnProgress _
), New Object() {Progress})
Else
Me.Button1.Text = Progress.ToString
ProgressBar1.Increment(1)
End If
End Sub
Private Sub OnDone()
m_Thread = Nothing
End Sub
Class MyThread
Public Event Progress(ByVal Progress As Integer)
Public Event Done()
Private m_Thread As Thread
Public Sub Start()
m_Thread = New Thread(AddressOf ThreadStart)
m_Thread.Start()
End Sub
Private Sub ThreadStart()
Dim i As Integer
With keywordwebrequest.GetRequestStream
For i = 1 To keywordresponsesize / 50000
'(keywordwebrequest.GetRequestStream.Write
Thread.Sleep(100)
RaiseEvent Progress(i)
Next
End With
RaiseEvent Done()
End Sub
End Class