I can use the IEditEvents to be notified of edits to features, but is there some way to be notified when the user in ArcMap makes changes to a table? For example, if the user uses the Attributes window to update a field in a table, I would like to know that an update has happened. I don't see IEditEvents_OnChangeFeature firing when I update an attribute in a table, which makes sense because it's not a feature that is changing. What I'm looking for is something like IEditEvents_OnAnyChange, just so I know that the user is doing some kind of insert update or delete. I'm using ArcMap 10.2.1.
Solved! Go to Solution.
You can use IObjectClassEvents:
Just change it to use IStandAloneTable and ITable instead of IFeatureClass:
Private WithEvents ObjectClassEvents As ObjectClassEvents
Public Sub initEvents()
Dim pMxdoc As IMxDocument
Set pMxdoc = Application.Document
Dim satColl As IStandaloneTableCollection
Set satColl = pMxdoc.FocusMap
Dim sat As IStandaloneTable
Set sat = satColl.StandaloneTable(0)
Dim t As ITable
Set t = sat.Table
' Dim pFeatureLayer As IFeatureLayer
' Dim pLayer As ILayer
' Dim pFeatureClass As IFeatureClass
' Set pLayer = pMxdoc.FocusMap.Layer(0)
' Set pFeatureLayer = pLayer
' Set pFeatureClass = pFeatureLayer.FeatureClass
Dim pObjectClass As IObjectClass
' Set pObjectClass = pFeatureClass
Set pObjectClass = t
Set ObjectClassEvents = pObjectClass
End Sub
Private Sub ObjectClassEvents_OnChange(ByVal obj As IObject)
MsgBox "OnChange for: " & obj.OID
End Sub
Private Sub ObjectClassEvents_OnCreate(ByVal obj As IObject)
MsgBox "OnCreate for: " & obj.OID
End Sub
Private Sub ObjectClassEvents_OnDelete(ByVal obj As IObject)
MsgBox "OnDelete for: " & obj.OID
End Sub
You can use IObjectClassEvents:
Just change it to use IStandAloneTable and ITable instead of IFeatureClass:
Private WithEvents ObjectClassEvents As ObjectClassEvents
Public Sub initEvents()
Dim pMxdoc As IMxDocument
Set pMxdoc = Application.Document
Dim satColl As IStandaloneTableCollection
Set satColl = pMxdoc.FocusMap
Dim sat As IStandaloneTable
Set sat = satColl.StandaloneTable(0)
Dim t As ITable
Set t = sat.Table
' Dim pFeatureLayer As IFeatureLayer
' Dim pLayer As ILayer
' Dim pFeatureClass As IFeatureClass
' Set pLayer = pMxdoc.FocusMap.Layer(0)
' Set pFeatureLayer = pLayer
' Set pFeatureClass = pFeatureLayer.FeatureClass
Dim pObjectClass As IObjectClass
' Set pObjectClass = pFeatureClass
Set pObjectClass = t
Set ObjectClassEvents = pObjectClass
End Sub
Private Sub ObjectClassEvents_OnChange(ByVal obj As IObject)
MsgBox "OnChange for: " & obj.OID
End Sub
Private Sub ObjectClassEvents_OnCreate(ByVal obj As IObject)
MsgBox "OnCreate for: " & obj.OID
End Sub
Private Sub ObjectClassEvents_OnDelete(ByVal obj As IObject)
MsgBox "OnDelete for: " & obj.OID
End Sub