Solved

Smooth progress bar while loading tables.

Posted on 2006-10-23
13
240 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
  • 5
  • 4
  • 3
  • +1
13 Comments
 
LVL 10

Accepted Solution

by:
Kinger247 earned 125 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

816 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now