Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66672

Re: Registering a Revit Event handler using VB

$
0
0

Hi Gary,

 

It seems like you've discovered that these event handlers are delegate instances. If that isn't necessarily the case: https://msdn.microsoft.com/en-us/library/ms172879.aspx

In adding the event handler you only need to pass the function which you intend to handle the event, no need to specify the arguments because the arguments are already specified by the delegate type declaration
more on delegates here: https://msdn.microsoft.com/en-us/library/aa288459(v=vs.71).aspx
Also, C#4.0 The Complete Reference has a great section on delegates that might help clarify.

When Revit calls your event handler it will pass in the pre-agreed upon arguments (as defined in the delegate type aka event) EventHandlers in .NET (I believe), are myEventHandler(object sender, EventArgs args) which allows you to define your own event handlers with this pattern of arguments which makes your "handler" function a "match" for the delegate type declaration for which you intend it to be a handler..

Here's another good read:
http://stackoverflow.com/questions/803242/understanding-events-and-event-handlers-in-c-sharp

All that should, in theory, be transmutatable to VB. (I am most definitely NOT and expert in VB so take that with the requisite grain of salt).

Hope I've understood your question and haven't given you a bunch of information you already know. But in the case that I have please feel free to clarify and we'll try to help however we can.


Viewing all articles
Browse latest Browse all 66672

Trending Articles