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: Tezuru Dasida
Country: Kazakhstan
Language: English (Spanish)
Genre: Art
Published (Last): 23 September 2010
Pages: 321
PDF File Size: 6.15 Mb
ePub File Size: 11.22 Mb
ISBN: 792-1-29066-262-3
Downloads: 51957
Price: Free* [*Free Regsitration Required]
Uploader: Zulkitilar

This will read the selected county information and display it on the form.

For more information on these topics, see the online help for ArcObjects for. Right-click the form created in Visual Studio and pick View Code. An easy way to do this is to export the form to be upgraded out of the VBA editor and open the exported file with the.

Arcobjecys contains counties and states for the entire United States. It must be manually re-created. This brings up Intelli-Sense and shows all the properties available to set on the label. 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. In the OnClick event, add the following two lines:.

This opens the County Info dialog box. The Customize dialog box.

New to ArcMap VBA | GeoNet

There is one last thing to do before the code is ready to use. There is one other major piece: This opens the code for the button. After changing the labels from caption to text, only one error remains.


At the very top of the code for the form, above the public class, add three import statements Figure 4. 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.

To set the xrcobjects to the labels in VBA, the property is called Caption. In this example, it removed the word Set and it put parentheses around the command pFLayer. This code could be improved. In this example, open the included file called Form1.

Go to the Customize menu and pick Add-In Manager Figure 6verify the add-in loaded, and close the dialog box. Doing this lets Visual Studio use the shorter names also. The Esri online help is very useful. Choose Add-In Controls from Categories arcobuects category that was defined when creating the add-in. This added a command button to the project.

How To: Create a new graticule using VBA and ArcObjects

He can be contacted at cgallant ljbinc. This is easily fixed by adding import statements at the top of the code.

Just adding the references won’t fix the problems because the code that was copied worked in VBA because the VBA editor understood the shorter names for ArcObjects. All the code has arcobjrcts converted for the form. Click the button to show the county form that was just dragged to the toolbar.

  LG LH-T255 PDF

You need to pick the option that best suits your application.

This example requires two references. After the project is built, the files are bundled as an add-in and automatically installed in ArcMap. That’s it for converting the code. Drag the My Form Button from Commands and drop it on any toolbar. 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.

Paste the subroutine in the code behind. However, as demonstrated in the next section, the code is reusable and easily upgraded.

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.

With a county selected, click the Read Data button on the dialog box. Side-by-side view of VBA code and. This is easy enough to fix.

Go to the error lblCountyName. In the Customize dialog box, click the Commands tab Figure 7. Figure 5 shows the code before and after. To fix this error, change ThisDocument to My. This article as a PDF. Most of these will go away once the right references are added.