ProgressBar help please

johncassell

Well-known member
Joined
Jun 10, 2007
Messages
120
Location
Redcar, England
Programming Experience
Beginner
Hi There,

I am looking for help on making a progressbar if someone wouldn't mind sparing their time.

Eventually I would like it to work with my reports but just for now I would like it to show the user how quickly my tableadapter has been filled. When I put a value in my WorkshopJobNumber text box and press enter, it fills my dataset...

VB.NET:
 Private Sub WorkshopJobNumberTextBox_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles WorkshopJobNumberTextBox.KeyUp
        If e.KeyCode = Keys.Enter Then
            Me.WorkshopJobsTableAdapter.FillBy(Me.RedcarWorkshopDataSet.WorkshopJobs, WorkshopJobNumberTextBox.Text)
        End If
    End Sub

All I have done is drag the progressbarcontrol1 onto my form and have no clue where to go from there.

Any help would be greatly appreciated.

Thanks

John
 
The reason that you never, ever see a progress bar that shows how much of a database query has already been executed/how many rows as a percentage of the total have been fetched, is because it is impossible.

From your point of view, Fill is an atomic operation. At time X, the dataset is empty and Fill has not been called. Later, at Time X+N, the dataset is 100% full of all the rows this Fill operation will perform.

So basically, if Fill takes 5 seconds.. At time 0, your progress bar says 0. At 5 seconds it suddenly jumps to 100%. == Useless progressbar


Your Fill operations should use indexed fields and select a small amount of records. To whit, it should never be the case that Fill takes so long that it NEEDS a progressbar. It should be over and done with before a progressbar would even have time to be drawn
 
yeah progress bars are pretty much useless for loading data. The only way you could really do it, is to time your data loads and then use a timer on your form.

I.e. you know it takes 20 seconds to load the data. Give or take network traffic, potentially that could take 30 seconds (although that's still a high amount of time! It should take milliseconds!!)

Use a timer on your form set to 30 seconds to then increase the progress bar - you know that within this 30 sec timeframe your data is loading.


In terms of loading reports I think you can do it - can't remember of the top of my head but I'm sure there's something along the lines of "WHILE report1.loads THEN..." which you can attach a progress bar to.
 
Back
Top