0

I am looking for guidance, suggestions, tips, or insights in performing a sequence of operations using VB macros for ArcGIS.

A) Creating a new table

How to write a macro in VB that creates a new table with its associated fields, loads the table to the current data frame, and adds the required records? For instance, a parcel table with fields

P_ID (Long)
L_Use_Code (Long)
L_Use_Name (string)
Owner_ID (Long)

B) Creating a new feature class

How to write a VB macro that creates a new shapefile feature class called "Parcel" and adds it to the map window?

C) Relating and joining data to layers

How to write a macro in VB that relates a table (as in (A)) to a layer (as in (B))?

D) Identification

How to write a macro in VB that shows a feature cursor operation to display the values of a given field for each row in a feature layer table?

Andre Silva
10.5k12 gold badges57 silver badges109 bronze badges
asked Jan 2, 2012 at 2:53
3
  • 7
    The downvotes may have been received due to the lack of formatting of the original text, which I have cleaned up; I hope it correctly reflects your questions, Bernabas. The downvotes may also reflect a perception that such a broad, basic question might result from a lack of research or previous investigation on your part. I won't speculate on that, but would only suggest you consider indicating where you have previously looked for help and where specifically you have encountered problems or obstacles in carrying out your objectives. Commented Jan 2, 2012 at 15:42
  • Also VBA is basically a dead language. Commented Jan 3, 2012 at 17:52
  • 1
    I would suggest looking into c#. VBA for arcgis is dead is not coming back. Commented Jan 4, 2012 at 12:21

1 Answer 1

2

If you insist on using VBA, Kang-Tsung Chang's Programming ArcObjects with VBA: A Task-Oriented Approach carries the answers to all your questions. It's written in cookbook format, which means answers are presented as encapsulated how-to code-samples for various topics rather than a "start programming from scratch" point of view.

Having said that, I want to further emphasize the point of the previous commentors: VBA is done, and ArcGIS will no longer support it. You must realize anything you code in VBA will require efforts later to rewrite it for a .Net implementation.

A discussion on getting started with ArcObjects and .Net can be found on this stackoverflow thread; unfortunately, though, there is a dearth of print media on the subject of programming ArcObjects with.Net. ESRI provides the best resource I know of, and you can start here. At the top of the page, note the links to Concepts and Samples, API Reference, and Code Gallery. ..personally, I get more use out of the API Reference (drill-down to .Net Samples in the menu at left) than anything else. For instance, here's a Create FeatureClass Snippet with examples in both VB.Net and C#.

Most of your questions relate to fundamental ArcObjects tasks, so I think it will be relatively easy to find help in the online reference; however, I suspect linking your first .Net solution into the ArcGIS Desktop UI (i.e. making a Button) may present some frustration. For that you'll need to install Visual Studio and the ArcObjects SDK (the SDK is included among the ArcGIS installation media). The ArcObjects SDK exposes various code "templates" to Visual Studio, and these are most helpful for creating buttons, et cetera. This example demonstrates how to create a ZoomTo button. Once you have Visual Studio running and the ArcObjects SDK installed, that tutorial will help you understand how to start a new project, and it will take you all the way through getting a new button in your ArcMap application window.

I think if you "daisy-chain" these resources together, you can probably dog-paddle through a DIY learning process. But don't expect it to be fast and easy. Be prepared to do alot of reading and endure some let-downs along your way to success.

answered Jan 4, 2012 at 18:04

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.