Hi, I'm working on a project to convert and older set of ArcGIS tools that were developed for 9.x using VB.NET. I'm trying to convert them to an Add-In for 10.4.
So far, I have created the Add-In and copied the code from the old project, but I'm getting an error that is preventing me from building the project. The old project has an ArcGIS class file which refers to MyBase.m_enabled when as part of the hook for accessing the application. In the new Add-In however, this reference gives a build error with the message:
'm_enabled' is not a member of 'Object'.
The full code for the ArcGIS class is below:
<ComClass(ArcGISClass1.ClassId, ArcGISClass1.InterfaceId, ArcGISClass1.EventsId),
Public Class ArcGISClass1
Private m_application As IApplication
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "4c9af923-e5db-428c-9626-24bd2403688b"
Public Const InterfaceId As String = "375cc171-dc44-4ff2-9929-ee4641481847"
Public Const EventsId As String = "02cf9a2e-0d56-4f11-91f7-649365beb8f7"
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
Public Sub OnCreate(ByVal hook As Object)
If Not hook Is Nothing Then
m_application = CType(hook, IApplication)
'Disable if it is not ArcMap
If TypeOf hook Is IMxApplication Then
MyBase.m_enabled = True
MyBase.m_enabled = False
The problem occurs on the two lines that read "MyBase.m_enabled = True" and "MyBase.m_enabled = False"
What is strange, though, is that all the other command and tools in this project contain the same code set in their OnCreate() methods and they don't trigger the error.
Is there some kind of difference between an older 9.3 project, and a new 10.4 Add-In that would cause this? Does the project need the ArcGIS Class to access the application?
Any advice would be appreciated!