Click here to Skip to main content
15,913,610 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error?!! Pin
Nafiseh Salmani19-Dec-06 23:37
Nafiseh Salmani19-Dec-06 23:37 
AnswerRe: Error?!! Pin
Guffa20-Dec-06 1:47
Guffa20-Dec-06 1:47 
GeneralRe: Error?!! Pin
Dave Kreskowiak20-Dec-06 6:02
mveDave Kreskowiak20-Dec-06 6:02 
GeneralRe: Error?!! Pin
Nafiseh Salmani21-Dec-06 23:19
Nafiseh Salmani21-Dec-06 23:19 
QuestionInvoking events on a different thread... Pin
Shy Agam19-Dec-06 22:03
Shy Agam19-Dec-06 22:03 
AnswerRe: Invoking events on a different thread... Pin
Tristan Rhodes20-Dec-06 0:41
Tristan Rhodes20-Dec-06 0:41 
GeneralRe: Invoking events on a different thread... Pin
Shy Agam20-Dec-06 2:16
Shy Agam20-Dec-06 2:16 
GeneralRe: Invoking events on a different thread... Pin
Tristan Rhodes20-Dec-06 2:30
Tristan Rhodes20-Dec-06 2:30 
Hi Shy,

I think the layouts a bit skewed.

You shouldn't really need to supply the control if the control can subscribe to the event.

try just using:

<br />
	private void RaiseConnectedEvent(IPEndPoint ep)<br />
	{<br />
		if (Connected != null)<br />
		{<br />
		Connected(ep);<br />
		}<br />
	}<br />


Then subscribe the relevant form to the event

<br />
class MyForm<br />
{<br />
	TCPSocket socket;<br />
	Control myControl;<br />
<br />
	// Handles socket.Connected event<br />
	private void SocketEventHandler(object sender, SocketEventArgs e)<br />
	{<br />
    // Handle Here (This will run on the executing thread NOT the GUI thread)<br />
<br />
    // Add the RunGuiThing delegate to the form invoker, this will<br />
    // run the desired delegate on the form / control creation thread.<br />
    me.Invoke(RunGuiThing);<br />
  }<br />
<br />
// GUI Handler<br />
  private void RunGuiThing()<br />
  {<br />
    // Update GUI control things here (This will be run on the GUI thread)<br />
    myControl.BackgroundColor = Color.Green;<br />
  }<br />
}<br />
<br />


Hope that solves it

Tris
GeneralRe: Invoking events on a different thread... Pin
Shy Agam20-Dec-06 2:37
Shy Agam20-Dec-06 2:37 
GeneralRe: Invoking events on a different thread... Pin
Tristan Rhodes20-Dec-06 3:10
Tristan Rhodes20-Dec-06 3:10 
GeneralRe: Invoking events on a different thread... Pin
Shy Agam20-Dec-06 3:23
Shy Agam20-Dec-06 3:23 
GeneralRe: Invoking events on a different thread... Pin
Tristan Rhodes20-Dec-06 3:35
Tristan Rhodes20-Dec-06 3:35 
GeneralRe: Invoking events on a different thread... Pin
Shy Agam20-Dec-06 3:47
Shy Agam20-Dec-06 3:47 
GeneralRe: Invoking events on a different thread... Pin
Tristan Rhodes20-Dec-06 3:56
Tristan Rhodes20-Dec-06 3:56 
Questiondll getting updated on clients Pin
fmardani19-Dec-06 22:02
fmardani19-Dec-06 22:02 
QuestionAxShockwaveFlash Pin
Nafiseh Salmani19-Dec-06 21:59
Nafiseh Salmani19-Dec-06 21:59 
Questionflash object Pin
Nafiseh Salmani19-Dec-06 21:49
Nafiseh Salmani19-Dec-06 21:49 
AnswerRe: flash object Pin
althamda19-Dec-06 23:07
althamda19-Dec-06 23:07 
GeneralRe: flash object Pin
Nafiseh Salmani19-Dec-06 23:35
Nafiseh Salmani19-Dec-06 23:35 
QuestionXslCompiledTransform problem with special chars Pin
karanba19-Dec-06 21:32
karanba19-Dec-06 21:32 
QuestionWhat's my IP Address?? Pin
Muammar©19-Dec-06 20:50
Muammar©19-Dec-06 20:50 
AnswerRe: What's my IP Address?? Pin
wedtm19-Dec-06 22:51
wedtm19-Dec-06 22:51 
GeneralRe: What's my IP Address?? Pin
Muammar©19-Dec-06 23:40
Muammar©19-Dec-06 23:40 
QuestionOpening... Pin
dsl/fahk19-Dec-06 20:25
dsl/fahk19-Dec-06 20:25 
AnswerRe: Opening... Pin
Tarakeshwar Reddy19-Dec-06 20:51
professionalTarakeshwar Reddy19-Dec-06 20:51 

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.