How To: Create a new graticule using VBA and ArcObjects. Summary. This article shows how to create a new graticule and set its properties in ArcMap. You might ask this after installing ArcGIS With the release of ArcMap 10, Visual Basic for Applications (VBA) is on the way out. As the online help article. Customizing and developing with ArcGIS > Writing macros using VBA the ArcGIS Desktop Developer Guide, or from Exploring ArcObjects.

Author: Arashisida Bami
Country: Lesotho
Language: English (Spanish)
Genre: Marketing
Published (Last): 14 October 2010
Pages: 121
PDF File Size: 1.5 Mb
ePub File Size: 19.19 Mb
ISBN: 473-9-55534-424-7
Downloads: 9414
Price: Free* [*Free Regsitration Required]
Uploader: Dougore

When the code is pasted, several errors will show up. Copy the subroutine and paste it into the newly created form in the add-in project.

Choose Add-In Controls from Categories the category that was defined when creating the add-in. In this example, open the included file called Form1.

Scroll down and pick the word Text. However, note that when pasting the code, Visual Studio did convert some code automatically. This is easy enough to fix.

There is one other major piece: From the Solution Explorer, right-click FormButton. This opens the code for the button.

Click the button to show the county form that was just dragged to the toolbar. The Customize dialog box.

They are authored in. Figure 5 shows the code before and after. However, as demonstrated in the next section, the code is reusable and easily upgraded. This is really the only major error in converting the code. The Esri online help is very useful. When all errors are fixed, Visual Studio displays the warning error “‘pFCursor’ is passed before arcobjefts is assigned.


This added a command button to the project. NET, to set the text to the label, the property qrcobjects called Text. Side-by-side view of VBA form and. Another way demonstrates one of the benefits of using the Visual Studio environment. That’s it for converting the code.

With a county selected, click the Read Data button on the dialog box. He can be contacted at cgallant ljbinc.

Go to the Customize menu and pick Add-In Manager Figure 6verify the add-in loaded, and close the dialog box. You need to pick the option that best suits your application. In conclusion, even though VBA is gone, with a little refactoring and a good bit of copying and pasting, existing VBA code can be reused in the new.

Second wizard screen for creating command button. If the ArcGIS templates do not show up when creating a new project, make sure you have. In the Customize dialog box, click the Commands tab Figure 7.

How To: Create a new graticule using VBA and ArcObjects

While it might have been easier to just retype Caption to Text, if the correct property is not known, this is a very useful feature. Place the cursor at the end of the word lblCountyName and press the period key.

Paste the subroutine in the code behind. One way would be to simply replace the word caption with the word text. In the OnClick event, add the following arcobjecst lines:.

Side-by-side view of VBA code and. This opens the County Info dialog box. Go to the Customize menu and pick Arcobjscts Mode. All the code has been converted for the form.


Doing this lets Visual Va use the shorter names also. Qrcobjects more information on these topics, see the online help for ArcObjects for.

The Add-In Manager dialog box. Because this article is intended to demonstrate the ease of converting VBA code to. The VBA sample for this exercise is a simple form that reads the selected county on the map and displays its information on the form. This example requires two references. They provide a declaratively based framework for creating a collection of customizations that can be conveniently packaged in a single compressed file that is easily shared. Click the Close button to close the County Info dialog box.

Now go to the Build menu and build the project.

How To: Create a new graticule using VBA and ArcObjects

NET, some of the description of the project creation process is not detailed. This is easily fixed by adding import statements at the top of the code. This will read the selected county information and display it on the form. When the add-in project was created, the Button checkbox was checked. Just adding the references won’t fix the problems because the code that was copied worked arcobjecs VBA because the VBA editor understood the shorter names for ArcObjects. You might ask this after installing ArcGIS There is one last thing to do before the code is ready to use.