Solved

Smooth progress bar while loading tables.

Posted on 2006-10-23
13
222 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
 

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

12 Experts available now in Live!

Get 1:1 Help Now