Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

How to reverse the flow of event calling?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jack Wright - 16 Sep 2004 09:13 GMT
Dear All,
  When an application programmer subscribes to an event...I would like
the execution to take place in a FILO mechanism...f.e.x.
this.button1.Click += new System.EventHandler(this.MyOwnClick );

this.button1.Click += new System.EventHandler(this.button1_Click );

when button1.Click() event is called...
I would like that button1_Click method be called before
this.MyOwnClick...

How do I achieve that?

Please help...

TALIA

Many Regards
Jack
Joey Callisay - 16 Sep 2004 10:56 GMT
I believe eventhandlers are executed asynchronously, so I think you should
use synchronous delegates

> Dear All,
>    When an application programmer subscribes to an event...I would like
[quoted text clipped - 15 lines]
> Many Regards
> Jack
Etienne Boucher - 17 Sep 2004 01:17 GMT
>I believe eventhandlers are executed asynchronously, so I think you should
> use synchronous delegates

Are they?

From MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fSystemDelegateClassTopic.asp


"The invocation list of a delegate is an ordered set of delegates in which
each element of the list invokes exactly one of the methods invoked by the
delegate. An invocation list can contain duplicate methods. During an
invocation, a delegate invokes methods in the order in which they appear in
the invocation list. A delegate attempts to invoke every method in its
invocation list; duplicates are invoked once for each time they appear in
the invocation list. Delegates are immutable; once created, the invocation
list of a delegate does not change."

Etienne Boucher
Joey Callisay - 20 Sep 2004 02:43 GMT
my mistake, thanx for pointing it out...

> >I believe eventhandlers are executed asynchronously, so I think you should
> > use synchronous delegates
>
> Are they?
>
> From MSDN

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fSystemDelegateClassTopic.asp


> "The invocation list of a delegate is an ordered set of delegates in which
> each element of the list invokes exactly one of the methods invoked by the
[quoted text clipped - 6 lines]
>
> Etienne Boucher
Paul Wardle - 19 Sep 2004 08:03 GMT
...just subscribe to the event once and call the method directly, i.e.

this.button1.Click += new System.EventHandler(this.MyOwnClick );

private void MyOwnClick (object sender, ...)
{
   this.button1_Click (sender, ...);

   ... code for MyOwnClick
}

> Dear All,
>    When an application programmer subscribes to an event...I would like
[quoted text clipped - 15 lines]
> Many Regards
> Jack

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.