How I use background worker with progress bar?
If my work is completed then progress bar will complete it's maximum length.
If not then it can't touch the maximum length.
I can't use them to make perfect look as i wish.
plz help me.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sam HobbsRank #107 · 20.5K reputationPosted Jul 5, 2010, 1:42 PM EDT
Do the work in the DoWork event. During the work, call ReportProgress and in the prgresschanged (whatever it is called) event update the progress bar.
Tanmay SarkarRank #1,407 · 1.2K reputationPosted Jul 5, 2010, 6:40 PM EDT
That's why I want to use progress bar.
I can use background worker & progress bar with "for" condition,
like for(int i=0;i<1000;i++).
But how i implement it, while it sending a mail?
help me plz!
Thank you Sir
Sam HobbsRank #107 · 20.5K reputationPosted Jul 5, 2010, 7:55 PM EDT
If so, then perhaps you can show a marquee style progress bar.
I assume you have a timeout value and your program will stop trying after the timeout period, so perhaps the progress bar could show the amount of time remaining before the timeout.
If you are unable to do the reading synchronously with a timeout that you can use to stop trying and then report progress then start trying again, then you must use asynchronous reads, and that will be a lot more work. It is something I have tried to do and I have not got it working entirely; I don't know what the problem is.
Tanmay SarkarRank #1,407 · 1.2K reputationPosted Jul 5, 2010, 8:19 PM EDT
I get your point. Actually there is varies type of connection so i can't limited it in a certain time period. So I think it's better to avoid progress bar because i build it for my those friends, who use slow connection, and waste lot of time to opening their mail ID to send mail. :-)
Thank you sir.