Message 1 of 48
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This is my fist time written an event handler. While my code has no errors, it doesn't work. Does anyone have any idea what I'm doing wrong?
Imports System.Windows.Controls
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Runtime
Namespace BeginSaveHandlingSample
Public Class SaveEventHandler
Implements IExtensionApplication
Public Sub Initialize()
Dim docs = Application.DocumentManager
AddHandler docs.DocumentCreated, AddressOf OnDocumentCreated
For Each doc As Document In docs
AddHandler doc.Database.BeginSave, AddressOf OnBeginSave
Next
End Sub
Private Sub OnDocumentCreated(ByVal sender As Object, ByVal e As DocumentCollectionEventArgs)
AddHandler e.Document.Database.BeginSave, AddressOf OnBeginSave
End Sub
Private Sub OnBeginSave(ByVal sender As Object, ByVal e As DatabaseIOEventArgs)
Application.ShowAlertDialog("It worked!")
End Sub
Public Sub Terminate()
End Sub
Private Sub IExtensionApplication_Initialize() Implements IExtensionApplication.Initialize
Throw New NotImplementedException()
End Sub
Private Sub IExtensionApplication_Terminate() Implements IExtensionApplication.Terminate
Throw New NotImplementedException()
End Sub
End Class
End Namespace
Solved! Go to Solution.