By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,131 Members | 1,749 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,131 IT Pros & Developers. It's quick & easy.

progress bar - what am I missing?

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
solved it myself thanks anyway.......
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.