Hello
I am trying to get some code to run whenever the active documents changes. As far as I can tell the code below should run when I load my app however it does not. I was able to get similar code to run copied from the .net devlopers guide but thier example involved the user runing a command to run the AddHandler part which is not what i want.
any help is appreciated.
Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Public Class CurrentDrawing Implements IExtensionApplication Public Sub Initialize() Implements IExtensionApplication.Initialize AddHandler Application.DocumentManager.DocumentActivated, AddressOf docColDocAct End Sub Public Sub Terminate() Implements IExtensionApplication.Terminate End Sub Public Sub docColDocAct(ByVal senderObj As Object, ByVal docColDocActEvtArgs _ As DocumentCollectionEventArgs) Application.ShowAlertDialog(docColDocActEvtArgs.Document.Name & " was activated.") End Sub End Class
Solved! Go to Solution.
Solved by Alfred.NESWADBA. Go to Solution.
Hi,
you have created a class that is derived from IExtensionApplication but AutoCAD will not call it. So you are missing the part that tells AutoCAD that there is an initialization-part.
Practically this means you have to add this line under your imports:
<Assembly: Autodesk.AutoCAD.Runtime.ExtensionApplication(GetType(CurrentDrawing))>
The red part may have to be exchanged to the fill NameSpace-name of your class-definition-name. With this statement AutoCAD knows there is an initialization part to run and it will do that when you NETLOAD your app.
- alfred -