Click here to Skip to main content
15,889,808 members
Home / Discussions / C#
   

C#

 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Nicholas Butler15-Feb-10 8:37
sitebuilderNicholas Butler15-Feb-10 8:37 
JokeRe: Cross-Threading problem, InvokeRequired and Events Pin
Wes Aday15-Feb-10 9:25
professionalWes Aday15-Feb-10 9:25 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Wes Aday15-Feb-10 11:10
professionalWes Aday15-Feb-10 11:10 
AnswerRe: Cross-Threading problem, InvokeRequired and Events Pin
Luc Pattyn15-Feb-10 8:37
sitebuilderLuc Pattyn15-Feb-10 8:37 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
User 680178015-Feb-10 9:55
User 680178015-Feb-10 9:55 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Luc Pattyn15-Feb-10 10:01
sitebuilderLuc Pattyn15-Feb-10 10:01 
QuestionRe: Cross-Threading problem, InvokeRequired and Events Pin
User 680178015-Feb-10 10:23
User 680178015-Feb-10 10:23 
AnswerRe: Cross-Threading problem, InvokeRequired and Events Pin
Luc Pattyn15-Feb-10 10:32
sitebuilderLuc Pattyn15-Feb-10 10:32 
Hi,

1.
Needing Applications.DoEvents() most often is an indication you did something wrong, such as having event handlers that take too much time (more than a few dozen milliseconds). And it is dangerous when being called from inside an event handler as it turns such handler into re-enterable code which you probably did not intend to do.

2.
You showing snippets and hopping around does not really help to clarify things, however I notice you use a TextBox for logging, which IMO is a bad idea, as TB and RTB keep all text lines in one, always growing, string, requiring lots of allocations, copies, and garbage collections. I strongly advice to log in a ListBox, where each new log message simply is one more entry in the Items collection.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.

GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
User 680178015-Feb-10 10:38
User 680178015-Feb-10 10:38 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Luc Pattyn15-Feb-10 11:30
sitebuilderLuc Pattyn15-Feb-10 11:30 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
User 680178015-Feb-10 10:45
User 680178015-Feb-10 10:45 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Luc Pattyn15-Feb-10 11:23
sitebuilderLuc Pattyn15-Feb-10 11:23 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Daniel Grunwald16-Feb-10 8:41
Daniel Grunwald16-Feb-10 8:41 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Luc Pattyn16-Feb-10 9:06
sitebuilderLuc Pattyn16-Feb-10 9:06 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Daniel Grunwald16-Feb-10 9:26
Daniel Grunwald16-Feb-10 9:26 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
User 680178016-Feb-10 9:42
User 680178016-Feb-10 9:42 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Daniel Grunwald16-Feb-10 9:49
Daniel Grunwald16-Feb-10 9:49 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
User 680178016-Feb-10 9:52
User 680178016-Feb-10 9:52 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Daniel Grunwald16-Feb-10 9:59
Daniel Grunwald16-Feb-10 9:59 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
User 680178016-Feb-10 10:31
User 680178016-Feb-10 10:31 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Daniel Grunwald16-Feb-10 8:45
Daniel Grunwald16-Feb-10 8:45 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
User 680178016-Feb-10 9:08
User 680178016-Feb-10 9:08 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Daniel Grunwald16-Feb-10 9:39
Daniel Grunwald16-Feb-10 9:39 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
Luc Pattyn16-Feb-10 9:45
sitebuilderLuc Pattyn16-Feb-10 9:45 
GeneralRe: Cross-Threading problem, InvokeRequired and Events Pin
User 680178016-Feb-10 10:02
User 680178016-Feb-10 10:02 

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.