.NET EventArgs

G

Guest

I understand how .NET standardizes event arguments by passing Sender and an
EventArgs class. But I have a bunch of old translated VB6 code that has a
bunch of events such as:

Public Event Click()

These old style events do not conform to the standard .NET convention.
Should I go back and manually convert everything to use the .NET standard?
What am I missing out on if I don't?
 
H

Herfried K. Wagner [MVP]

TrtnJohn said:
I understand how .NET standardizes event arguments by passing Sender and an
EventArgs class. But I have a bunch of old translated VB6 code that has a
bunch of events such as:

Public Event Click()

These old style events do not conform to the standard .NET convention.
Should I go back and manually convert everything to use the .NET standard?

It's simply a convention which makes consuming the event easier because of
the 'sender' parameter which provides access to the object which raised the
event.
What am I missing out on if I don't?

Nothing if your code works :).
 
C

CMM

If your class is meant to be consumed by other developers then I would
suggest you change your events scheme. The nice thing about the sender/args
scheme is you can have a single procedure handle multiple events on multiple
controls This is useful for menus and things like that (similarly
accomplished using Control Arrays in VB classic).

.... Handles Control1.DragDrop, Control2.DragDrop etc, Controls3.DragDrop

Or using AddHandler(...)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top