We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Smooth progress bar while loading tables.

ParanoidOne asked
Medium Priority
Last Modified: 2008-02-26
This is a minor concern, more polishing than functionality. I still figure I will ask. Right now I load 3 dataadapters and the progress bar moves as each is loaded. 33% for each dataadapter, pretty choppy huh ? There has got to be a way to make it smoother, ideas ??
Watch Question

Your best bet is to create a progress bar that will never end, thus just giving an indication that something is happening.
Unless you can load every record individually, you won't be able to update stage by stage.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
If you know the total number of records, and you can get your head around the maths, its possible...

I would suggest running it on a seperate thread, but you can have a loop to continously check the total number of records in the dataset, compare this to your total number and you have what record your currently loading. Do this for each dataset and then add the maths to make each one count for 33% of the progress bar. You can set the maximum value to 100 so you work in percentages... Its do-able, if you know the total amount of records?
DjDezmond, how do you know when each individual record is being loaded into the adapter ?


Well that could be a problem really. The total number will change daily, also the criteria of the select changes so will the total number of records loaded.
  Doesn't look like you can do it then.

  Can you query the .count property of a dataadapter as its being filled? It's not something i have tried, just a thought.


As far as I have seen you cannot get the count as it is getting filled. Seems like the process is consumed as it is filled. I know you can fill an adapter in "chunks" so I guess I could give it a start record and end record, like maybe a thousand records, then update the bar, the get next thousand records, maybe ?
That is one way to do it...

I have found an example that works, but it adds the records one by one, and first queries the count value. It would most probably just be too much overhead for what its worth. Ill post it anyway:

I think the way you suggested would be the best way though...
I think your flogging a dead horse there, to much hard work for little in return.

You've got to call the db and count the total number or records out going to extract, then perform the whole operation again to fill the adapter.

I'd go with an animated progress bar myself :)


Animated progress bar, any in mind ?
or a normal progress bar on a timer ...

I created (doctor'd) a progress bar that resembled the sky+ progress bar .. do you want me to post the code ?



If you're loading lots of records you may actually find a datareader faster than a dataadapter.  Here's a discussion about that


Have a look, in particular, at the last post in the thread.

The upside of using a datareader is that it would allow you to update your progress bar even on a record by record basis if you were so minded.  The downsides are (a) that you would yourself have to program the allocation of the data to your datatables; (b) you would probably still have to program a dataadapter to handle updates; and (c) the very fact of counting records as they came in might slow the process down too much.

Whether it would all be worth it just for "polishing" is an open question.  But it's an idea you might like to explore.



Yeah a datareader not been ruled out, at least not in the future. At the moment though that would require a re-write, that is not happening at the moment with the current time spent.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.