|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
.NET EventArgsI 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? "TrtnJohn" <TrtnJ***@discussions.microsoft.com> schrieb: It's simply a convention which makes consuming the event easier because of >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? 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 :-).-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> 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(...) Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:ujgmtd1JGHA.420@tk2msftngp13.phx.gbl... > "TrtnJohn" <TrtnJ***@discussions.microsoft.com> schrieb: >>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 :-). > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> |
|||||||||||||||||||||||