Click here to Skip to main content
12,894,700 members (59,936 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# VB VB.NET

with the help of remoting I created client and server two applciation. From client application I am handling server
side events. but problem is that after I invoke event.Event
back tracking is going on. server application is opening from
sub main. After I call event from client applicaiton evnet back
tracking is going on and event start going back and back up to
sub main. and ging error of

Could you please suuges how should I stop event back tracking

Posted 6-Feb-13 5:51am
What is "event backtracking"? "Backtracking" is some algorithm, not related to events. Do you mean something I don't know? Please describe what do you mean by event backtracking, exactly.
Quazi Areeb 7-Feb-13 2:19am
No I am not talking about Backtracking algorithm.i.e. my form is opening from sub main function using I have one event Hello() which is I am calling from another application. after all code execute cursor goes to back to but I want after complete Hello event, code execution should stop. I tried with return; but not worked

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Events are not one way, if you are debugging and tracing your events, the event calls a function (the receiver) and when it is finished the call stack MUST collapse back up to the event firing routine.

What I think your problem is, is that you are interacting on the UI from a different thread (events are spawned in new threads). Interacting with a form from an event will cause an exception (where the event is fired, not where you interact with the UI).

In order to interact with the UI, you have to invoke (using the Form.Invoke or Control.Invoke) methods if the InvokeRequired flag is true on the form or control. This is true even when opening new forms or setting properties of existing controls or forms, otherwise you can get an IllegalCrossThreadException or an application hang.
Quazi Areeb 7-Feb-13 2:14am
Yes you are right but I already used InvokeRequired flag is true with form.Invoke and things working fine. but in some scenario they are not. for ex. I Invoke method from another application after method execution completed cursor automatically goes to which is in sub main and giving error. I want after my method code execute code execution should stop there and not to go to
InvokeRequired only indicates the call from a thread other then UI thread, nothing else. Invoke is a mechanism of invocation of delegates on the UI thread.
Everything you are talking about simply makes no sense, as it is based on some misconception.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 6 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100