ProgressBar Incrementation

  • Thread starter Thread starter eBob.com
  • Start date Start date
E

eBob.com

I'd like my progress bar to increment by a minimal amount for each item
processed, so that it would increment steadily and gradually. As I read the
doc I think that the code below should do it. But what I get is that on the
second call to IncProgressBar a rather wide bar is drawn, maybe about 15
pixels, and then nothing happens until about the 30th call when another wide
bar is drawn. What am I doing wrong or misunderstanding? Thanks, Bob

Public Shared Sub AddProgressBar(ByVal uiform As Form1, ByRef si As
SiteRunOpts, ByVal numitems As Integer)
si.progbarProgress = New ProgressBar
With si.progbarProgress
.Width = numitems \ 2
.Maximum = numitems
.Location = New Point(progbarProgress_xloc, si.yloc)
.Step = 1
End With
uiform.Controls.Add(si.progbarProgress)
End Sub 'AddProgressBar

Public Shared Sub IncProgressBar(ByVal si As SiteRunOpts, ByVal val As
Integer)
si.progbarProgress.PerformStep()
End Sub
 
eBob.com schreef:
I'd like my progress bar to increment by a minimal amount for each item
processed, so that it would increment steadily and gradually. As I read the
doc I think that the code below should do it. But what I get is that on the
second call to IncProgressBar a rather wide bar is drawn, maybe about 15
pixels, and then nothing happens until about the 30th call when another wide
bar is drawn. What am I doing wrong or misunderstanding? Thanks, Bob

Public Shared Sub AddProgressBar(ByVal uiform As Form1, ByRef si As
SiteRunOpts, ByVal numitems As Integer)
si.progbarProgress = New ProgressBar
With si.progbarProgress
.Width = numitems \ 2
.Maximum = numitems
.Location = New Point(progbarProgress_xloc, si.yloc)
.Step = 1
End With
uiform.Controls.Add(si.progbarProgress)
End Sub 'AddProgressBar

Public Shared Sub IncProgressBar(ByVal si As SiteRunOpts, ByVal val As
Integer)
si.progbarProgress.PerformStep()
End Sub


My guess is you actually want to do this:
si.progbarProgress.Increment()

Another thing is that your program might be so busy it doesn't get the
time to update the screen. You might want to add an
application.doevents() to your InProgressBar sub.
 
Back
Top