Kevin,
I would be very surprised if the code you have there would even compile. The reason is that you are using an Implements statement, but you are not fulfilling the contract by actually implementing the interface. I think the solution to your problem is to implement the interface(IExtensionApplication) fully and when you do, add an event handler to the Initialize method.
Here is some example code..........
[code]
Imports Autodesk.AutoCAD.Runtime
Imports AcadApp = Autodesk.AutoCAD.ApplicationServices.Application
[/code]
< extensionapplication="">
[code]
Public Class MyApp
Implements IExtensionApplication
'This Attribute doesn't show up well in the Discussion Group
'Replace *** with <
'Replace @@@ with >
***Assembly: ExtensionApplication(GetType(MyApp))@@@
Public Sub Initialize() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Initialize
AddHandler AcadApp.DocumentManager.DocumentCreated, AddressOf DocumentCreated
End Sub
Public Sub Terminate() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Terminate
'I think that this will always generate an error because by the time this code
'is called, the document manager is destroyed.
'but if AutoDesk someday add a .NET unload option, you may need this to remove
'your event from the call stack
Try
RemoveHandler AcadApp.DocumentManager.DocumentCreated, AddressOf DocumentCreated
Catch ex As Exception
End Try
End Sub
Private Sub DocumentCreated(ByVal sender As Object, ByVal e As Autodesk.AutoCAD.ApplicationServices.DocumentCollectionEventArgs)
'Do stuff here when a document is created
End Sub
End Class
[/code]
Good luck,
C
Message was edited by: CougerAC
Message was edited by: CougerAC>