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 / March 2006

Tip: Looking for answers? Try searching our database.

Generic Event Handler

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sudhee - 22 Mar 2006 15:06 GMT
Is there any generic event arguments which will suffice all type of event
arguments for example I want to capture all the events in the form like this
public sub generalEvent(byval sender as ..., eventarg ...)  
control.Mousemove,mouseclick,click etc

Thanks
Sudheendra
Kingsley - 22 Mar 2006 16:32 GMT
All custom event arguements must inherit from the EventArgs class, so you can
pass this type to your generic event handler.  You'll have to find a way to
determine the specific event that occured to enable you cast the EventArgs
type to the actual type you need in other to access the right
methods/properties of the event args.

public sub generalEvent(object sender, EventArgs e)
{
}

Hope this helps...

> Is there any generic event arguments which will suffice all type of event
> arguments for example I want to capture all the events in the form like this
[quoted text clipped - 3 lines]
> Thanks
> Sudheendra
Nick Hounsome - 22 Mar 2006 16:56 GMT
> All custom event arguements must inherit from the EventArgs class,

No - It's only a convention. Events can have any delegate type whatsoever.
Alex Clark - 22 Mar 2006 22:31 GMT
Plus, I may be mistaken but I think the signature of the event handling
routine must match the delegate precisely - it can't just use the basic
EventArgs class as it's second parameter if it's going to handle (for
example) the MouseDown event (which requires a subclass of MouseEventArgs or
something like that).

>> All custom event arguements must inherit from the EventArgs class,
>
> No - It's only a convention. Events can have any delegate type whatsoever.
Zoodor - 24 Mar 2006 16:00 GMT
> Plus, I may be mistaken but I think the signature of the event handling
> routine must match the delegate precisely - it can't just use the basic
> EventArgs class as it's second parameter if it's going to handle (for
> example) the MouseDown event (which requires a subclass of MouseEventArgs or
> something like that).

I may be wrong, but isn't this allowed in dot net 2.0?

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.