Click here to Skip to main content
15,886,689 members
Home / Discussions / C#
   

C#

 
GeneralRe: Existence of “Add” Function causes WCF to Fail Pin
OriginalGriff8-Feb-21 4:01
mveOriginalGriff8-Feb-21 4:01 
GeneralRe: Existence of “Add” Function causes WCF to Fail Pin
Bernhard Hiller8-Feb-21 4:03
Bernhard Hiller8-Feb-21 4:03 
AnswerRe: Existence of “Add” Function causes WCF to Fail Pin
Gerry Schmitz8-Feb-21 4:45
mveGerry Schmitz8-Feb-21 4:45 
QuestionHow to avoid progress bar freeze when calculations are performed in background? Pin
Alex Dunlop7-Feb-21 8:18
Alex Dunlop7-Feb-21 8:18 
GeneralRe: How to avoid progress bar freeze when calculations are performed in background? Pin
harold aptroot7-Feb-21 8:24
harold aptroot7-Feb-21 8:24 
GeneralRe: How to avoid progress bar freeze when calculations are performed in background? Pin
Alex Dunlop7-Feb-21 16:24
Alex Dunlop7-Feb-21 16:24 
AnswerRe: How to avoid progress bar freeze when calculations are performed in background? Pin
Gerry Schmitz7-Feb-21 10:19
mveGerry Schmitz7-Feb-21 10:19 
AnswerRe: How to avoid progress bar freeze when calculations are performed in background? Pin
Luc Pattyn7-Feb-21 17:18
sitebuilderLuc Pattyn7-Feb-21 17:18 
When you execute a lengthy operation (any computation exceeding say 50 msec, but also anything that might occasionally be slow, e.g. an internet access) in one of the GUI event handlers (e.g. a button's Click), it will block the main=GUI thread, as a result your GUI freezes.

There are a number of bad attempts to fix this. The good ones all involve another thread, but then, beware, other threads are not allowed to touch your GUI Controls. The recommended approach is by using one BackGroundWorker; it will perform the bulk of the job on a separate thread, yet it provides a progress reporting event which automatically does run on the main=GUI thread, so that is by far the number one way to keep your GUI alive and responsive.

When the BGW finishes up, it fires a Completion event which typically is used to report all mishaps that may have occurred (make sure to handle its Exception which unfortunately there is called Error), it could also be used to e.g. re-enable a Button; that event handler also runs on the main=GUI thread, again no worries.

If unfamiliar with BGW, look for (a) the documentation and (b) a good example, and study these first. It may seem complex, but it isn't; it is the easiest way into multi-threading, something most applications are bound to take advantage of.

Smile | :)
Luc Pattyn [My Articles]
If you can't find it on YouTube try TikTok...

QuestionWinForm launching a console application Pin
picasso22-Feb-21 18:32
picasso22-Feb-21 18:32 
AnswerRe: WinForm launching a console application Pin
Gerry Schmitz2-Feb-21 18:36
mveGerry Schmitz2-Feb-21 18:36 
GeneralRe: WinForm launching a console application Pin
Dave Kreskowiak2-Feb-21 18:42
mveDave Kreskowiak2-Feb-21 18:42 
GeneralRe: WinForm launching a console application Pin
Gerry Schmitz3-Feb-21 6:20
mveGerry Schmitz3-Feb-21 6:20 
GeneralRe: WinForm launching a console application Pin
Dave Kreskowiak3-Feb-21 6:39
mveDave Kreskowiak3-Feb-21 6:39 
GeneralRe: WinForm launching a console application Pin
Gerry Schmitz3-Feb-21 6:59
mveGerry Schmitz3-Feb-21 6:59 
GeneralRe: WinForm launching a console application Pin
Dave Kreskowiak3-Feb-21 7:13
mveDave Kreskowiak3-Feb-21 7:13 
GeneralRe: WinForm launching a console application Pin
Gerry Schmitz3-Feb-21 7:28
mveGerry Schmitz3-Feb-21 7:28 
AnswerRe: WinForm launching a console application Pin
Dave Kreskowiak2-Feb-21 18:40
mveDave Kreskowiak2-Feb-21 18:40 
AnswerRe: WinForm launching a console application Pin
OriginalGriff2-Feb-21 19:48
mveOriginalGriff2-Feb-21 19:48 
GeneralRe: WinForm launching a console application Pin
trønderen3-Feb-21 3:58
trønderen3-Feb-21 3:58 
GeneralRe: WinForm launching a console application Pin
OriginalGriff3-Feb-21 5:13
mveOriginalGriff3-Feb-21 5:13 
AnswerRe: WinForm launching a console application Pin
TimWallace8-Feb-21 18:03
TimWallace8-Feb-21 18:03 
QuestionHow to sum up values of duplicate keys in a dictionary? Pin
Alex Dunlop2-Feb-21 6:37
Alex Dunlop2-Feb-21 6:37 
AnswerRe: How to sum up values of duplicate keys in a dictionary? Pin
Dave Kreskowiak2-Feb-21 12:35
mveDave Kreskowiak2-Feb-21 12:35 
GeneralRe: How to sum up values of duplicate keys in a dictionary? Pin
Alex Dunlop3-Feb-21 5:39
Alex Dunlop3-Feb-21 5:39 
GeneralRe: How to sum up values of duplicate keys in a dictionary? Pin
Dave Kreskowiak3-Feb-21 6:36
mveDave Kreskowiak3-Feb-21 6:36 

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.