I do not work much in VB, but somebody recently asked how to subscribe to the Revit application events in that language. There is no VB sample for this in the Revit SDK samples, so I created the following little solution to demonstrate it.
The steps to create it are exactly the same as for a C# project, and were actually described in detail for both C# and VB in the post on Debugging a Revit Add-In, but here is the really short version:
- Create a new class library project
- Reference RevitAPI.dll
- Set its 'Copy Local' flag to false
- Derive your class from IExternalApplication
- Implement the member methods
I have copied the full Visual Studio solution AppEventsVb here. It is very straight forward to create from scratch, actually, and using Intellisense as much as possible really helps. For instance, the moment I typed 'Implements IExternalApplication.OnShutdown', the skeleton code for two methods is automatically added by Visual Studio.
Also useful for anyone who is a VB coder and wants to convert samples is the many VB to C# code converters available:
http://www.google.com.au/search?source=ig&hl=en&rlz=1G1GGLQ_ENAU244&=&q=C%23+to+VB+code+converter&btnG=Google+Search&meta=
such as:
http://www.developerfusion.com/tools/convert/csharp-to-vb/
and
http://www.carlosag.net/Tools/CodeTranslator/
they may not do whole projects but they can help you decipher the samples!
Posted by: Rod Howarth | October 14, 2008 at 22:16
Hi Rod,
Thank you very much for your comment. It prompted me to write a post mentioning Lutz Roeder's wonderful Reflector analyser and IL decompilation tool, available at
http://www.aisto.com/roeder/dotnet
I am in the process of posting it right now ...
Thank you for the inspiration!
Best regards,
Jeremy
Posted by: Jeremy | October 27, 2008 at 05:38