B
Bill Angus
Hi all:
I have been playing around trying to get a progress bar to work. So far, I
have the progress bar updating visibly, but the rest of the dialog now looks
crappy. The rest of the dialog window badly needs a repaint, but it doesn't
get one until the routine finishes that the progress-bar is attached to.
I think part of the problem is that I don't understand the syntax for using
delegates and threads completely. Can any one point me to a web-article on
this topic, or perhaps tell me what I am doing wrong? I thought I had worked
the progress-bar more or less according to the VS2005 docs.
Example code follows
========================
' blah blah.... initial code
Delegate Sub UIDelegate()
Sub updateUI()
Me.ProgressBar1.Increment(1)
End Sub
Private Sub CreateBigCatalog() ' my time consuming routine
' Setup progress bar
Dim newDelegate As New UIDelegate(AddressOf updateUI)
Me.ProgressBar1.Value = 0
Me.ProgressBar1.Maximum = 1000
For Each title As DataRow In MyTitleTable.Rows
ProgressBar1.Invoke(newDelegate)
' ..... blah blah more time consuming code ....
next title
end sub
-----
What should I have done differently?
Thanks in advance and have a great day!
Bill Angus, MA
http://www.psychtest.com
I have been playing around trying to get a progress bar to work. So far, I
have the progress bar updating visibly, but the rest of the dialog now looks
crappy. The rest of the dialog window badly needs a repaint, but it doesn't
get one until the routine finishes that the progress-bar is attached to.
I think part of the problem is that I don't understand the syntax for using
delegates and threads completely. Can any one point me to a web-article on
this topic, or perhaps tell me what I am doing wrong? I thought I had worked
the progress-bar more or less according to the VS2005 docs.
Example code follows
========================
' blah blah.... initial code
Delegate Sub UIDelegate()
Sub updateUI()
Me.ProgressBar1.Increment(1)
End Sub
Private Sub CreateBigCatalog() ' my time consuming routine
' Setup progress bar
Dim newDelegate As New UIDelegate(AddressOf updateUI)
Me.ProgressBar1.Value = 0
Me.ProgressBar1.Maximum = 1000
For Each title As DataRow In MyTitleTable.Rows
ProgressBar1.Invoke(newDelegate)
' ..... blah blah more time consuming code ....
next title
end sub
-----
What should I have done differently?
Thanks in advance and have a great day!
Bill Angus, MA
http://www.psychtest.com