Create a geoprocessing tool to buffer a layer and retrieve messages


Purpose
This sample demonstrates execution of a geoprocessing tool using the .NET geoprocessor assembly. In addition, it demonstrates how to retrieve messages from the geoprocessing framework. To show these concepts, this sample makes a geoprocessing tool that buffers a layer.

How to use

See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Start Visual Studio and open the solution.
  2. Build the solution to make the Buffer selected layer command .dll. You will need to use this command in an application with a MapControl and a ToolbarControl, or inside ArcMap.
  3. Add the command to the ToolbarControl. The command can be found in the .NET Samples category with the name, Buffer selected layer.
  4. Run the application and add any feature layer to the map (you can add as many feature layers as you want).
  5. Click the Buffer selected layer command to show the Buffer dialog box.
  6. From the layers drop-down list, select the layer that you want to buffer.
  7. Select the buffer distance and units.
  8. Click Buffer to run the Buffer tool. As the tool executes, note the messages on the messages dialog box.

BufferSelectedLayerCmd.cs The command that opens the Buffer dialog box.
BufferDlg.cs The Buffer dialog box source code.
BufferDlg.Designer.cs The Buffer dialog box designer file.
Download the C# files
BufferSelectedLayerCmd.vb The command that opens the Buffer dialog box.
BufferDlg.vb The Buffer dialog box source code.
BufferDlg.Designer.vb The Buffer dialog box designer file.
Download the VB.NET files

Download the files for all languages

See Also:

How to run a geoprocessing tool
Accessing licensing and extensions for the geoprocessor
How to get returned messages




Development licensing Deployment licensing
Engine Developer Kit Engine Runtime
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo