<ESRI.Configuration xmlns="http://schemas.esri.com/Desktop/AddIns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Name>CSTutorial</Name> <AddInID>{4e2c325a-27f5-4d4b-b2a0-266819364cc2}</AddInID> <Description>C# tutorial</Description> <Version>1.0</Version> <Image>Images\CSTutorial.png</Image> <Author>jobruce</Author> <Company>YGS</Company> <Date>7/13/2011</Date> <Targets> <Target name="Desktop" version="10.0" /> </Targets> <AddIn language="CLR" library="CSTutorial.dll" namespace="CSTutorial"> <ArcMap> <Commands> <Button id="YGS_CSTutorial_StaggerOffsetButton" class="StaggerOffsetButton" message="Stagger Offset: Offsets all feature in selected layer by a user-specified stagger amount on either side of the original position. Start an edit session before use." caption="Stagger Offset Features" tip="Stagger Offset Features: Offsets all features in selected layer." category="Add-In Controls" image="Images\StaggerOffsetButton.png" /> </Commands> <Toolbars> <Toolbar id="YGS_CSTutorial_CS_Toolbar" caption="CS_Toolbar" showInitially="true"> <Items> <Button refID="YGS_CSTutorial_StaggerOffsetButton" /> </Items> </Toolbar> </Toolbars> </ArcMap> </AddIn> </ESRI.Configuration>
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Windows.Forms; namespace CSTutorial { public class StaggerOffsetButton : ESRI.ArcGIS.Desktop.AddIns.Button { public StaggerOffsetButton() { } protected override void OnClick() { // // TODO: Sample code showing how to access button host // ArcMap.Application.CurrentTool = null; MessageBox.Show("Hello world"); } protected override void OnUpdate() { Enabled = ArcMap.Application != null; } } }
Hi there,
I'm trying to learn how to use Visual Studio to create a button that loads a form. I'm using Visual Studio Express 2008 (VB.NET). I've followed, step by step, two tutorials:
http://gis.qtools.com/blog/tutorials/vba-to-c-add-in/part-4-creating-new-add-in-project/ (up to Part 4 and using VB.NET)
http://www.esri.com/news/arcuser/0311/recycling-vba.html
In neither tutorial have I been able to get a form to load. In the case of the first tutorial, I can't even get a message box to display. It's pretty frustrating.
So, I started from scratch in a new project (ArcMapAddIn1). It is a button (Button1) on a toolbar (My Toolbar). When the button is pressed a message box is supposed to pop up (this is under the OnClick event for Button1). Nothing happens when I press the button! It just goes grey.
Any ideas about what I'm missing here?
Cheers,
Olwyn