Click here to Skip to main content
15,909,652 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi ,
please help me to find this out, i am posting this question 2nd time here in 3 days.

in my windows application on button click i am downloading data from SQL database to XML files, it takes 8 to 10 sec to download, in that time i want to show progress bar in UI.

i tried many ways

1) i tried using BackgroundWorker from this link http://eclipsed4utoo.com/blog/windows-form-progressbar/[^]

2) i use threading concept with Begin invoke method

3) and also using simple timer for updating progress bar

In every time progress bar showing status after data downloading completed.
I want to show Progress Bar when data downloading from online to xml.

none of the methods above are not worked perfectly, plz help me.

link for same question i posted in 3 days back Show progress bar in windows forms application[^]
Posted
Comments
Pheonyx 26-Oct-13 8:45am    
Having read your first question, you need to be doing the data download in the DoWork method of the background worker and not back on the main thread. Else you are defeating the purpose of the whole exercise because the download still locks the main thread up.

1 solution

You don't update the progressbar value from a background thread. You do the WORK of downloading the data in the background thread and then tell the UI thread to update the progressbar. UI controls can NOT be touched in any way from a background thread.

Also, if this is going to work at all depends entirely on your "database download" code. We haven't seen that at all and without that, it's impossible to tell you if you're doing something wrong there that defeats the purpose of a progressbar.
 
Share this answer
 

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