• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • Last Modified:

Smooth progress bar while loading tables.

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
ParanoidOne
Asked:
ParanoidOne
  • 5
  • 4
  • 3
  • +1
1 Solution
 
Kinger247Commented:
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
 
DjDezmondCommented:
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
 
Kinger247Commented:
DjDezmond, how do you know when each individual record is being loaded into the adapter ?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ParanoidOneAuthor Commented:
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
 
DjDezmondCommented:
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
 
ParanoidOneAuthor Commented:
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
 
DjDezmondCommented:
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
 
Kinger247Commented:
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
 
ParanoidOneAuthor Commented:
Animated progress bar, any in mind ?
0
 
Kinger247Commented:
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
 
ParanoidOneAuthor Commented:
Sure.
0
 
SanclerCommented:
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
 
ParanoidOneAuthor Commented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now