- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've searched, tried language conversion utilities, etc., etc... I simply can't find a working example (or anything in any version of help for the API on any site or in the Labs) of registering for Revit events.
The C# method would be:
thisApp.ControlledApplication.DocumentCreated += New EventHandler(Of DocumentCreatedEventArgs)(eventHandlerMethod)
or:
thisApp.ViewActivated += New EventHandler(Of ViewActivatedEventArgs)(eventHandlerMethod)
I believe that the += and -= for registering and unregistering events needs to be replaced with AddHandler and RemoveHandler in VB but I have been unable to find the correct synax and requirements for what needs to be/ can be passed to the handler function. From the C# examples and documentation I know that the eventHandlerMethod should be able to receive the sending object and the event arguments themselves.
Intellisense and Microsoft help tells me that the AddHandler function should look something like this:
AddHandler thisApp.ControlledApplication.DocumentCreating, AddressOf (eventHandlerMethod(origObject, DocumentCreatedEventArgs))
or:
AddHandler thisApp.ViewActivated, AddressOf (eventHandlerMethod(origObject, ViewActivatedEventArgs))
So how do I pass the event arguments (and, in the case of an modified object, the object that was modified... I know, I didn't provide such an example but, just thinking ahead here) to my "eventHandlerMethod" (as used in my example)?
-Gary
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
aka (current and past user names)
GaryOrrMBI (MBI Companies 2014-Present), Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Solved! Go to Solution.