Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai everybody,
I just need to update the progress bar as when retrieving data from db i am using vb.net. I have seen lot of blogs but all their said are get the count of the records after loop it for progress bar. I feel that's waste for showing progress bar. So you any one guys help me to show the progress status changing while retrieving the data.
Posted

1 solution

All those blogs are correct.

A query filling a DataTable or DataSet does NOT report any kind of progress information for you to use.

If you want to show a progress bar with the number of records being returned being 100%, you have NO CHOICE AT ALL but to get the count of records first, then repeat the query and use a SqlReader to iterate and process over each record, one at a time. Count the number of records you have read/processed and that gives you the percentage.

The only other progressbar you can use is the marquee. There is no 100% progress, but you get the scrolling "something is happening" scroll on the bar. The only way to make that work though is if you put your SQL retrieval code on it's own thread, freeing up the UI (startup) thread to repaint the progressbar constatnly so you see "something is happening".
 
Share this answer
 
Comments
Sahayapraveen 20-Mar-14 2:34am    
Thank you Dave i understand it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900