Tutorial :Display Progress Bar at the Time of Processing


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?


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)


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              Rs.MoveNext            Next P  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »