?
Solved

Smooth progress bar while loading tables.

Posted on 2006-10-23
13
Medium Priority
?
264 Views
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 ??
0
Comment
Question by:ParanoidOne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
  • +1
13 Comments
 
LVL 10

Accepted Solution

by:
Kinger247 earned 375 total points
ID: 17788842
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.
0
 
LVL 9

Expert Comment

by:DjDezmond
ID: 17788890
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?
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17788936
DjDezmond, how do you know when each individual record is being loaded into the adapter ?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ParanoidOne
ID: 17788980
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.
0
 
LVL 9

Expert Comment

by:DjDezmond
ID: 17789017
ParoidOne...
  Doesn't look like you can do it then.

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

Author Comment

by:ParanoidOne
ID: 17789049
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 ?
0
 
LVL 9

Expert Comment

by:DjDezmond
ID: 17789259
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:
  http://www.vb-tips.com/dbPages.aspx?ID=49f2cff5-56ad-44fc-a4c6-fc0d5c470f53

I think the way you suggested would be the best way though...
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17789289
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 :)
0
 

Author Comment

by:ParanoidOne
ID: 17789381
Animated progress bar, any in mind ?
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17789538
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 ?
0
 

Author Comment

by:ParanoidOne
ID: 17790163
Sure.
0
 
LVL 34

Expert Comment

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

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21518119.html

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.

Roger
0
 

Author Comment

by:ParanoidOne
ID: 17790664
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.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month9 days, 5 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question