dfroehli

Controlled Deactivation of Add-In Tool using VB.net

Discussion created by dfroehli on Mar 16, 2012
Latest reply on Apr 4, 2013 by mravichandran
I am using Visual Basic 2008 Express to develop a tool for correcting the locations of features. The user first selects the feature, then activates the tool and clicks on the correct location. The tool then starts edit mode and relocates the feature. At this point I want ArcMap to remain in edit mode until the user deactivates the tool, after which the user will be asked if he wants to save his edits. My problem is that I cannot figure out how to acquire control when the tool is deactivated.

The following simplified code illustrates the approach that I am trying to use. However, VB2008 gives the following error: "Interface 'ESRI.ArcGIS.SystemUI.ITool' is not implemented by this class". Can anyone tell me what I am doing wrong? 


Public Class MoveIt
Inherits ESRI.ArcGIS.Desktop.AddIns.Tool

Public Sub New()
MsgBox("Hello")
End Sub

Protected Overrides Sub OnUpdate()
Enabled = My.ArcMap.Application IsNot Nothing
End Sub

Public Function Deactivate() As Boolean Implements ESRI.ArcGIS.SystemUI.ITool.Deactivate
MsgBox("GoodBy")
Deactivate = True
End Function

End Class

Outcomes