Click here to Skip to main content
15,907,001 members
Home / Discussions / C#
   

C#

 
QuestionDesign pattern ask for advice Pin
George_George24-Oct-08 1:21
George_George24-Oct-08 1:21 
AnswerRe: Design pattern ask for advice Pin
Ennis Ray Lynch, Jr.24-Oct-08 3:07
Ennis Ray Lynch, Jr.24-Oct-08 3:07 
GeneralRe: Design pattern ask for advice Pin
George_George25-Oct-08 0:31
George_George25-Oct-08 0:31 
AnswerRe: Design pattern ask for advice Pin
led mike24-Oct-08 4:40
led mike24-Oct-08 4:40 
GeneralRe: Design pattern ask for advice Pin
Mark Salsbery24-Oct-08 5:21
Mark Salsbery24-Oct-08 5:21 
GeneralRe: Design pattern ask for advice Pin
led mike24-Oct-08 6:12
led mike24-Oct-08 6:12 
GeneralRe: Design pattern ask for advice Pin
George_George25-Oct-08 0:33
George_George25-Oct-08 0:33 
GeneralRe: Design pattern ask for advice Pin
George_George25-Oct-08 0:32
George_George25-Oct-08 0:32 
AnswerRe: Design pattern ask for advice Pin
led mike24-Oct-08 6:32
led mike24-Oct-08 6:32 
GeneralRe: Design pattern ask for advice Pin
George_George25-Oct-08 0:34
George_George25-Oct-08 0:34 
QuestionHow to scroll a listview with scrollable property disabled Pin
vayanan24-Oct-08 0:02
vayanan24-Oct-08 0:02 
AnswerRe: How to scroll a listview with scrollable property disabled Pin
AhsanS24-Oct-08 0:11
AhsanS24-Oct-08 0:11 
GeneralRe: How to scroll a listview with scrollable property disabled Pin
vayanan24-Oct-08 0:16
vayanan24-Oct-08 0:16 
GeneralRe: How to scroll a listview with scrollable property disabled Pin
AhsanS24-Oct-08 0:35
AhsanS24-Oct-08 0:35 
AnswerRe: How to scroll a listview with scrollable property disabled Pin
Eddy Vluggen24-Oct-08 0:15
professionalEddy Vluggen24-Oct-08 0:15 
AnswerRe: How to scroll a listview with scrollable property disabled Pin
Simon P Stevens24-Oct-08 0:37
Simon P Stevens24-Oct-08 0:37 
QuestionBeginReceive: How do I get out of the thread when reachig callback function? Pin
Kurt23-Oct-08 23:41
Kurt23-Oct-08 23:41 
AnswerRe: BeginReceive: How do I get out of the thread when reachig callback function? Pin
Simon P Stevens24-Oct-08 0:20
Simon P Stevens24-Oct-08 0:20 
GeneralRe: BeginReceive: How do I get out of the thread when reachig callback function? Pin
Kurt24-Oct-08 0:35
Kurt24-Oct-08 0:35 
GeneralRe: BeginReceive: How do I get out of the thread when reachig callback function? Pin
Simon P Stevens24-Oct-08 0:42
Simon P Stevens24-Oct-08 0:42 
GeneralWhy don't we need invoke events of controls? Pin
Kurt24-Oct-08 1:41
Kurt24-Oct-08 1:41 
GeneralRe: Why don't we need invoke events of controls? Pin
Simon P Stevens24-Oct-08 1:53
Simon P Stevens24-Oct-08 1:53 
Kurt wrote:
Hmm, I thought of making a DLL, so the users can double click the event in the property window and fill in individual code. But the user would be forced to use invoke.


Yes, they would, but this is how winforms works so they should understand that. All GUI controls must be accessed from the GUI thread, so any calls coming from a different thread must use invoke to transfer control to the GUI thread.

Kurt wrote:
We can use so many different controls in our projects and use their events without invoke. Do all those controls doesn't use asynchronous processes?


All GUI controls only use the GUI thread, so their events are all raised on the GUI thread, so it isn't a problem.

The difference with your code is that the event is coming from an callback provided by your sockClient object. This is only natural, incoming data could come in at any point, so the object watching for the data must be doing it on a different thread, otherwise it would block the GUI. So when it triggers the callback, it's coming from a different thread, that is why an invoke onto the GUI thread is required.

Simon

AnswerRe: BeginReceive: How do I get out of the thread when reachig callback function? Pin
Gideon Engelberth24-Oct-08 3:04
Gideon Engelberth24-Oct-08 3:04 
AnswerRe: BeginReceive: How do I get out of the thread when reachig callback function? [modified] Pin
Alan N24-Oct-08 8:13
Alan N24-Oct-08 8:13 
AnswerSolution incl. example :-) Pin
Kurt27-Oct-08 0:50
Kurt27-Oct-08 0:50 

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.