Get value of field in attribute table

4267
2
Jump to solution
01-15-2015 05:03 PM
JeffMorton
New Contributor

Hi all,

I am brand new to programming for ArcGIS, so please bear with me. I'm hoping that there is a sample or walkthrough for this.

When a user clicks on a point I need to be able to read the value in a field in the attribute table for that point (I will then open a form that reads data from an external database and allows the user to edit it.

In the same vein, I need to allow the user to click on a tool and then click a spot on the layer and create a point there, then open the same form as above and enter the data about the point.

Any guidance would be greatly appreciated.

I'm programming in Visual Studio 10 (VB.Net) and ArcGIS 10.

J

0 Kudos
1 Solution

Accepted Solutions
ChrisKushnir
New Contributor III

Two of the most common enhancements you will write are commands and tools.

A typical command is a toobar button.  Your command class will receive the OnClick event and you can do what you want from there.  There is generally no user interaction with the map.

A typical tool is a toolbar button that sets your tool class as the 'active' tool.  There is no more than one active tool at a time.  As long as your tool is the active tool it will receive mouse events as the user interacts with the map.

ArcObjects 10 .NET SDK Help  Commands and Tools

ArcObjects 10 .NET SDK Help  Walkthrough Create a custom Tool

So, you probably want to create one or two tools.  If the points will always be 'far' apart you could create one tool that either creates a new point at a click location, or edits any existing point within a specified radius of the click location.

In either case the code is similar, you create a class that inherits from the correct base class and implements the required interfaces and the write the code to handle OnClick e.g. convert the windows coord mouse click position to map coordinates, search for point features within a radius of your point feature, open a dialog to display/edit attributes of your point feature.

Instead of searching withing a radius of the click location you could also setup the snapping environment when your tool is activated.

ArcObjects 10 .NET SDK Help  Snapping in ArcGIS 10

View solution in original post

0 Kudos
2 Replies
ChrisKushnir
New Contributor III

Two of the most common enhancements you will write are commands and tools.

A typical command is a toobar button.  Your command class will receive the OnClick event and you can do what you want from there.  There is generally no user interaction with the map.

A typical tool is a toolbar button that sets your tool class as the 'active' tool.  There is no more than one active tool at a time.  As long as your tool is the active tool it will receive mouse events as the user interacts with the map.

ArcObjects 10 .NET SDK Help  Commands and Tools

ArcObjects 10 .NET SDK Help  Walkthrough Create a custom Tool

So, you probably want to create one or two tools.  If the points will always be 'far' apart you could create one tool that either creates a new point at a click location, or edits any existing point within a specified radius of the click location.

In either case the code is similar, you create a class that inherits from the correct base class and implements the required interfaces and the write the code to handle OnClick e.g. convert the windows coord mouse click position to map coordinates, search for point features within a radius of your point feature, open a dialog to display/edit attributes of your point feature.

Instead of searching withing a radius of the click location you could also setup the snapping environment when your tool is activated.

ArcObjects 10 .NET SDK Help  Snapping in ArcGIS 10

0 Kudos
JeffMorton
New Contributor

Thanks! That helped.

0 Kudos