Display Progress Bar at the Time of Processing

Go To StackoverFlow.com


If I am getting data from the database from start time to end time, during that time (of processing / querying), I want to display a progress bar (something like, “Processing, please wait”). How can I do this?

2009-06-16 07:28
by NoName
I'm not sure I understand the question: is this a real-time scenario in which you are running a series of queries against the database which will stop when "end date" is reached? Or is it a single query that takes a long time to run, and you want to provide a progress bar for the query? Perhaps you could include the data access statements and table definitions, too - cheduardo 2009-06-16 08:07


Steps of geting data from db:

  1. app send query to db
  2. db analyzes query and prepares result
  3. db send result back to app

In most cases you cannot say how much time it will take, so instead of progress bar think about combination of:

  • hour glass mouse pointer
  • "please wait" in status bar
  • little animation (windmill, rotating gear wheels etc)
2009-06-16 09:55
by Michał Niklas
I came here to post essentially the same thing.

If you are waiting on the query, you can't say how much time it is going to take.

The best option is a little animation bar on a form that displays overtop of your current display - Daemonic 2009-06-16 12:55


While its true that you cant tell how long the query is going to take, its possible to give your user and idea of the time lapsed/remaining. You use the progress bar control from your VB IDE. You then set its 'max' property to your query recordcount. As you iterate through the records increase the progress bars 'value' property. Here's an example; ('Rs' is an ADODB recordset)

        ProgressBar1.Max = Rs.RecordCount - 1

        For P = 0 To .RecordCount - 1
           ProgressBar1.Value = P

            'some process here

        Next P
2009-06-17 12:34
by Jack Njiri