Book a Course
GIS Books & Literature
Other Training Services
Useful GIS Training Sites

Course Details

Introduction to Programming ArcObjects using VBA

ArcObjects components are the building blocks of ArcGIS software. To support or automate organisational work flow tasks, ArcObjects can be used to extend core ArcGIS functionality and create custom applications. This course provides a foundation for application development using VBA and ArcObjects. In course exercises, students create usable ArcObjects code for typical GIS programming tasks. Students work with VBA development tools and the ArcGIS Customize dialog box and learn how to access online help resources. After completing the course, students will have a variety of sample code from which they can build their own applications.

This course is designed for developers and for experienced ArcGIS users who may be new to programming with VBA.

- download course outline PDF

Duration: 3 day(s)

Price: £1185-00   (Book this Course)

Schedule for this course:

 03/09/2007 - 05/09/2007
 29/10/2007 - 31/10/2007
 10/12/2007 - 12/12/2007

• Introduction to ArcGIS Part 1 or have equivalent knowledge experience
• A basic proficiency in Visual Basic or VBA programming
• Students should know the following:

Declare and use variables
Write function and sub procedures
Use conditional statements (i.e. If, Then, Else, Select Case)
Work with loops (Do and While loops)
Create forms, add controls, and write event procedures

• If the above is not known, an introductory course in VB/VBA must be completed before the start of the course.

This course is designed for experienced VBA developers and experienced GIS users who are new to programming ArcObjects.

• Customise the ArcGIS graphical user interface
• Understand basic VBA concepts
• Navigate ArcObjects object model diagrams
• Access ArcObjects help resources and determine the appropriate objects for code
• Program with geographic data, display, geometry, and other objects

Topics Covered:

VBA development environment: Customising the user interface; Writing and debugging code

VB language fundamentals: VB syntax; Code storage; VB functions; Branching and looping; Creating user forms

Object-oriented programming concepts: Objects and classes; Class libraries; Methods; Properties; Events

COM: Advantages of COM; Defining a COM class; Interface programming

Reading OMDs: Class relationships; Class types; Using diagrams to write code

Maps and layers: Accessing maps and layers; Adding a layer to ArcMap; Classifying and symbolising layers

Working with data: Accessing data sets on disk; Creating new data; Editing data; Applying a domain to a geodatabase field

Geometry: Creating various types of geometry; Displaying geometry on the display; Storing geometry; Spatial operations

Spatial and attribute selections: Accessing a user selection; Defining an attribute or spatial query; Processing a subset of records

Symbology and layer rendering: Creating new symbols and modifying their characteristics; Accessing different types of renderers; Accessing custom symbols to a renderer

Layouts: Programmatically formatting a map layout; Adding elements; Defining symbols and colours for map elements; Accessing items from the ArcMap style gallery

Creating tools: Getting user input; Transforming mouse input to map units and working with the display

Programming ArcObjects events: Outbound versus inbound interfaces; Finding events on OMDs; Accessing an object's outbound interface

Using ArcObjects beyond VBA: An Overview of creating your own custom components in VB; What the ArcGIS Engine Developer Kit and ArcGIS Server products can be used for

Related Courses:
Please refer to the Learning Paths for related courses

Outline of Topics:
The VBA development environment
• The VBA development environment
• ArcGIS commands
• Using the Customize dialog box
• The Customize dialog
• Using the Customize dialog box
• Creating a new command
• Setting control properties
• Accessing your customizations
• Storing your customizations
• Examining a control’s source code
• Demonstration
• The Visual Basic Editor
• Understanding ArcMap software’s code storage
• Writing Visual Basic statements
• Some common Visual Basic functions
• Procedure types
• Running an event procedure
• Navigating event procedures in a module
• The ThisDocument module
• Creating a new module
• Creating a new sub or function procedure (macro)
• Defining procedure scope
• Running a subroutine or function procedure
• Adding a macro to a toolbar
• Getting help

Visual Basic code: How, where, and when?
• Object-oriented programming
• Example: Object-oriented terms
• How: Visual Basic syntax
• Preset ArcObjects variables
• Automatic code completion
• Where: Controls, documents, and forms
• Working with forms
• Setting properties at design time
• Writing code for a form
• Using control properties at run time
• When: Form and control events
• When: Map document events
• Saving your work

Using variables
• Variables
• Working with variables
• Dim (dimension) statement
• Assigning a value to a variable
• Function procedures
• Comparing values
• Decision making: The If Then statement
• Controlling If Then
• Decision making: The Select Case statement
• Levels of variable scope
• Procedure-level variables
• Module-level variables
• Public-level variables
• Static variables

Programming with class
• Class
• Classes and objects
• Class libraries
• ArcObjects Class Libraries
• Exploring class libraries with the Object Browser
• Object Browser icons
• Creating objects at design time
• Instantiating an object in code
• To Set or not to Set?
• Coding a class with Visual Basic
• Client and server environment
• Distributing your classes
• Demonstration: Creating a simple class

COM before the storm
• Introducing COM
• COM classes have interfaces
• Working with ArcObjects COM classes
• More on interfaces …
• Polymorphism
• ArcObjects polymorphism
• Using methods and properties
• Getting other interfaces
• Testing an object reference
• COM class code
• Using library names
• Using the ESRI Object Browser
• Demonstration: Creating a COM class

Understanding object model diagrams
• ArcObject object model diagrams
• Relationship symbols
• ArcMap objects
• Creatable Class (CoClass)
• Instantiable Class (Class)
• Abstract class
• Inheritance
• Property and method symbols
• Getting properties
• Setting properties
• Finding interfaces
• Wormholes
• Finding object model diagrams
• Finding the right OMD: Step 1
• Finding the right OMD: Step 2
• Finding the right OMD: Step 3
• Finding the right OMD: Step 4
• Where to begin? Getting into the OMD
• Example: MxDocument > Map > layer

Maps and layers
• Loop review
• Object model overview
• Accessing maps
• Looping through a collection of maps
• Managing flow in a loop
• Accessing layers
• Working with a map’s layers
• Looping through layers
• Working with layer properties
• Adding a new layer to a map
• Setting a FeatureLayer’s data source

Data access and creation
• Data creation objects
• Opening an existing Workspace
• Connecting to an ArcSDE database
• Getting a FeatureDataset
• Getting FeatureClasses
• Pseudocode: Adding a data layer
• GxDialog
• Example: GxDialog
• Working with Name objects
• Creating a new Workspace
• Creating a new Table or FeatureClass
• Field and Fields classes
• IField and IFieldEdit
• Creating a Fields collection
• Creating a Table or FeatureClass
• Work with fields in a table
• Adding rows and values to a table

Geometry and geoprocessing
• Geometry objects
• Feature geometry
• Points and multipoints
• Segments
• Polylines and polygons
• Envelopes
• Zooming in to a Feature
• Displaying features
• Geometry spatial operator interfaces
• ITopologicalOperator
• IRelationalOperator
• IProximityOperator
• Area and length
• Spatial reference
• Spatial reference OMD

Working with subsets and selections
• Object Model overview
• SelectionSet
• Cursors and FeatureCursors
• Creating a QueryFilter
• Returning a Search cursor
• SpatialFilter
• Three types of cursors
• Accessing records in a cursor
• Example: Summarizing a cursor’s attributes
• Review: Features and geometry
• Displaying a subset of features with subsets and selections

Symbolizing elements and layers
• Subclasses of Symbol
• Using color
• ColorRamps
• Creating simple graphic elements
• Example: Make a new element, set its symbol
• Defining an element’s position
• Adding an element to the map (or layout)
• FeatureRenderers
• SimpleRenderer
• UniqueValueRenderer
• ClassBreaksRenderer
• ScaleDependentRenderer
• Storing layers on disk
• GxLayer object
• Example: Saving a layer from ArcMap

Working with layout elements (optional)
• Object Model overview
• Review: Elements
• FrameElements
• Example: Reference MapFrames on the layout
• Review: Subclasses of Symbol
• Review: Color classes
• The StyleGallery
• Getting style items from the gallery
• Example: Referencing an individual style item
• Getting the item
• Basic steps: Adding a map surround
• StyleSelector
• Printing a layout
• Exporting a layout

Using tools
• Tool events
• Getting the user X and Y
• Display transformation
• Convert display coordinates to map units
• Example: Rubberbanding
• IGraphicsContainer
• Managing graphics
• Refreshing the display
• Partially refresh the display

Data management
• Name objects
• Object Model overview: Name classes
• Creating a DatasetName
• Data manipulation objects
• Converting feature classes
• Editing with a cursor
• Editing cursors
• Example: Updating misspelled attributes
• Adding a field
• Creating a domain
• Adding a domain to a database
• Assigning a domain to a field

Application framework and events
• Customizing the user interface
• CommandBars class
• Types of CommandBar objects
• Components of CommandBar: CommandItems
• Finding a CommandItem
• Finding an ArcGIS toolbar or menu
• Document events
• Example: Displaying a different context menu
• Displaying a new shortcut menu
• Creating new menus
• Creating commands to execute macros
• Updating the ArcID module
• Inbound and outbound interfaces
• Finding outbound interfaces
• Using an outbound interface
• Events supported by Map
• Capturing object events
• Coding object events

ArcObjects beyond VBA
• Visual Basic versus VBA
• Remember COM?
• Basic steps: Building a COM component
• 1) Create a new COM project
• 2) Create a COM class
• 3) Reference the appropriate libraries
• 4) Implement the required interface(s)
• Referencing the Application
• Example: Branching in a COM component
• 5) Compile your component DLL
• 6) Registering your COM component
• Where can COM components plug in?
• Resources for creating custom components
• ArcGIS Engine
• ArcGIS Engine Developer Kit
• Engine Runtime
• Why ArcGIS Engine Developer Kit?
• ArcGIS Engine Developer Kit resources
• ArcGIS Server
• Why ArcGIS Server?
• ArcGIS Server resources



Related Sites:   ESRI International   My ESRI (UK)   MapsDirect   ESRI Ireland