3

I had written several VBA routines for ArcGIS up through v9.3 and have since upgraded to 10. Since VBA will be a thing of the past in the next version, I downloaded and installed VB Express 2008 and successfully (I think) migrated the VBA to VB.Net 2008. I saved out each of the routines to their respective *.vb files and ran the Add-In wizard for a new project, adding each routine as a button added to a toolbar.

Everything compiles and I get my toolbar to show up in ArcMap, but when I press any of the buttons, they grey out and nothing executes. Similarly, the breakpoints I have inserted go hollow with a yellow triangle and when I hover over the breakpoint, it states that "The breakpoint will not currently be hit. No symbols have been loaded for this document."

I think that somehow I am missing the magic of how to tie the XML stuff (which I understand controls the toolbar and buttons) to the VB.Net code (which perform the actions). Is there any VB code that links the code back to the XML so it functions?

Any insight is greatly appreciated.

Thanks,

Dale Bridgford

P.S (added later) To provide a bit more background, I am enclosing a portion of the code. This is typical of what I have cludged together from various posts. All variations that I have tried are equally inoperative.

Again, any insight as to where I have gone astray would be greatly appreciated.

Thanks, Dale Bridgford

` Imports ESRI.ArcGIS.Geometry

Namespace ERMDTools

Public Class btnAddHyperlink
 Inherits ESRI.ArcGIS.Desktop.AddIns.Button
 Public Sub New()
 End Sub
 Protected Overrides Sub OnClick()
 Dim pFeature As IFeature, pLayer As ILayer
 Dim pMap As IMap
 Dim pSRE As SpatialReferenceEnvironment
 Dim pQF As IQueryFilter
 Dim pMSR As ISpatialReference
 Dim pGeoDataset As IGeoDataset
 Dim pMxDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument
 pMxDoc = Nothing
 pMxDoc = m_App.Document
 pMap = pMxDoc.FocusMap
 pMSR = pMap.SpatialReference `
RyanKDalton
23.3k19 gold badges114 silver badges180 bronze badges
asked Nov 22, 2010 at 18:21
2
  • To provide a bit more detail to my question, all of the routines I had written, check for the existence of a field in the attribute table, create the field if not present, and populates the field. In reading about add-ins, there were some limitations, but I didn't quite catch whether working on the table structure would be within those limitations. Commented Nov 30, 2010 at 15:46
  • Does anyone have any ideas on this? Commented Dec 9, 2010 at 20:04

2 Answers 2

1

I have solved my dilemma, more or less. I have found that the structure of the vb for the Add-In needed to be as follows:

[CODE]Imports ....

Public Class btnAddHyperlink Inherits ESRI.ArcGIS.Desktop.AddIns.Button

Public Sub New()
End Sub
Protected Overrides Sub OnClick()
 Dim pFeature As IFeature, pLayer As ILayer
 Dim pSRE As SpatialReferenceEnvironment
 Dim pQF As IQueryFilter[/CODE]

and with that structure, the button would hit the code. Again, many thanks for everyone's assistance.

Dale

answered Dec 17, 2010 at 21:56
1
  • Sorry but what is the difference from your original code? You haven't specified what needs to change... Commented Jun 4, 2013 at 23:53
0

After struggling with this issue myself and getting nowhere, I think I've found a couple of culprits.

First one: If you're targeting ArcMap 10.0, you can only use .NET 3.5. ArcMap 10.1 will support 4.0.

Second: Your projects should target AnyCPU. Mine were targeting x86 which was causing the behaviour Dale described above -> clicking the button then it goes gray. When I switched to AnyCPU this problem went away.

I hope this helps somebody. Cheers.

answered Jun 5, 2013 at 20:53

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.