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:
In most cases you cannot say how much time it will take, so instead of progress bar think about combination of:
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
Rs.MoveNext
Next P