Click here to Skip to main content
15,914,111 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to use progress bar according to the code execution timing. Pin
Pete O'Hanlon28-Feb-11 2:30
mvePete O'Hanlon28-Feb-11 2:30 
GeneralRe: How to use progress bar according to the code execution timing. Pin
Ankur\m/28-Feb-11 2:53
professionalAnkur\m/28-Feb-11 2:53 
AnswerRe: How to use progress bar according to the code execution timing. Pin
coolestCoder28-Feb-11 2:21
coolestCoder28-Feb-11 2:21 
AnswerRe: How to use progress bar according to the code execution timing. Pin
Pete O'Hanlon28-Feb-11 2:26
mvePete O'Hanlon28-Feb-11 2:26 
GeneralRe: How to use progress bar according to the code execution timing. Pin
GenJerDan28-Feb-11 3:46
GenJerDan28-Feb-11 3:46 
GeneralRe: How to use progress bar according to the code execution timing. Pin
Pete O'Hanlon28-Feb-11 4:18
mvePete O'Hanlon28-Feb-11 4:18 
GeneralRe: How to use progress bar according to the code execution timing. Pin
GenJerDan28-Feb-11 4:25
GenJerDan28-Feb-11 4:25 
AnswerRe: How to use progress bar according to the code execution timing. Pin
Luc Pattyn28-Feb-11 2:27
sitebuilderLuc Pattyn28-Feb-11 2:27 
If you want a snappy GUI and/or you want to show some progress, you should limit the execution time of each of your GUI event handlers to say less than 30 msec. So having lengthy operations in a Form Load handler is no good; you should instead:
- launch a thread (possibly a BackgroundWorker) in the Form Load handler;
- have that thread perform the lengthy operation (e.g. database access) and store results in some data structure;
- then use Invoke to have the GUI thread update the GUI, showing the newly acquired data, and probably enabling the Controls that now should be functional.

When the operation that needs to show progress is indivisible, you can't really show progress, all you can indicate is that time is progressing, so you should estimate a worst-case time span, and show a progress bar that advances at periodic points in time. A System.Windows.Forms.Timer is excellent for such purpose.

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

AnswerRe: How to use progress bar according to the code execution timing. Pin
_Erik_28-Feb-11 5:01
_Erik_28-Feb-11 5:01 
AnswerRe: How to use progress bar according to the code execution timing. Pin
RaviRanjanKr28-Feb-11 17:20
professionalRaviRanjanKr28-Feb-11 17:20 
QuestionStatic Method Pin
anishkannan28-Feb-11 1:06
anishkannan28-Feb-11 1:06 
AnswerRe: Static Method Pin
Keith Barrow28-Feb-11 1:32
professionalKeith Barrow28-Feb-11 1:32 
GeneralRe: Static Method Pin
anishkannan28-Feb-11 2:08
anishkannan28-Feb-11 2:08 
AnswerRe: Static Method Pin
OriginalGriff28-Feb-11 2:51
mveOriginalGriff28-Feb-11 2:51 
AnswerRe: Static Method Pin
OriginalGriff28-Feb-11 1:36
mveOriginalGriff28-Feb-11 1:36 
GeneralRe: Static Method Pin
Keith Barrow28-Feb-11 2:58
professionalKeith Barrow28-Feb-11 2:58 
QuestionSAX Parser Pin
NarVish28-Feb-11 0:20
NarVish28-Feb-11 0:20 
AnswerRe: SAX Parser Pin
Yusuf28-Feb-11 0:46
Yusuf28-Feb-11 0:46 
GeneralRe: SAX Parser Pin
NarVish28-Feb-11 0:55
NarVish28-Feb-11 0:55 
QuestionHow can I block an http request? Pin
rahul.kulshreshtha27-Feb-11 23:43
rahul.kulshreshtha27-Feb-11 23:43 
AnswerRe: How can I block an http request? Pin
Tony Richards28-Feb-11 0:01
Tony Richards28-Feb-11 0:01 
GeneralRe: How can I block an http request? Pin
rahul.kulshreshtha1-Mar-11 23:13
rahul.kulshreshtha1-Mar-11 23:13 
AnswerRe: How can I block an http request? Pin
rahul.kulshreshtha1-Mar-11 23:16
rahul.kulshreshtha1-Mar-11 23:16 
QuestionIs there a cute way to do this - sort of challenge Pin
Mycroft Holmes27-Feb-11 21:45
professionalMycroft Holmes27-Feb-11 21:45 
AnswerRe: Is there a cute way to do this - sort of challenge Pin
Dalek Dave27-Feb-11 22:47
professionalDalek Dave27-Feb-11 22:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.