Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I developed a user form that allows user to edit feature attributes in visual basic 2008. vb.net. The add-in's that I built work great on my computer, but when I tried it on another, it crashes ArcMap.

is this because the DeveloperKit is not installed on the other computer??


I manually add-in the tool (i.e., Customize, Add from file, etc) and it looks like it installs. ArcMap crashes when I click on the button though. On my computer it work correctly using the same method.

I have uploaded the file to here: http://wfurl.com/3611b10

THANKS

share|improve this question
1  
Does it crash ArcMap while it starting up? Or once ArcMap is up and running and you try to use an AddIn component(button/tool/dockable window)? –  Jay Cummins Jan 9 '12 at 21:50
    
The SDK is not required to run add-ins. Something else is causing the crash, but you'll have to elaborate on your question for anyone to be able to suggest how to fix it. Ideally post your VS solution to someplace like smartbins.net. –  blah238 Jan 9 '12 at 22:56
    
Edited question to link to code –  user5373 Jan 9 '12 at 23:06
1  
My guess is it has to do with the Microsoft.VisualBasic.PowerPacks.Vs dependency. Likely your clients' machines don't have it installed. See: social.msdn.microsoft.com/Forums/en/vbpowerpacks/thread/… –  blah238 Jan 9 '12 at 23:21
1  
I think it is best practice to have a try/catch surrounding whatever you're doing in the Button's OnClick. Also should call ReleaseComObject on your cursor at some point. –  Kirk Kuykendall Jan 10 '12 at 1:09
show 7 more comments

2 Answers

up vote 2 down vote accepted

(Months later...)

The answer is to not reference 3rd party dependencies if they aren't on the clients' machines and you aren't distributing them with your add-in. In this case it was the Visual Basic Power Packs dependency, which from the sounds of it wasn't being used anyways.

You should also be sure to implement error handling at all entry points to your add-in so that the host ArcGIS application does not swallow the errors or crash.

share|improve this answer
add comment

You should study the link at http://fontstuff.com/vba/vbatut08.htm.

The following function may be used in the workbook_open event.

sub workbook_open()
call resolve_addin
end sub

Sub RESOLVE_ADDIN()
For K = 1 To ActiveWorkbook.Worksheets.Count
Worksheets(K).Activate
For Each CL In ActiveSheet.UsedRange.Cells
If CL.HasFormula Then
If InStr(CL.Formula, "AddIns") Then
fcoma1 = InStr(CL.Formula, "'")
fcoma2 = InStr(CL.Formula, "!")
String_Replace = Mid(CL.Formula, fcoma1, fcoma2 - fcoma1 + 1)

    CL.Replace What:=String_Replace _
                , Replacement:="", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:= _
        False, SearchFormat:=False, ReplaceFormat:=False
    CL.Rows.AutoFit
End If
End If
Next
Next
End Sub

share|improve this answer
2  
This has nothing to do with the question at all. –  blah238 Sep 11 '12 at 14:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.