Validate table selection


The editor button on the editor toolbar has a command called Validate Selection. When working with geodatabases this command can be used to determine if any of the selected features in the map violate the rules defined in the geodatabase. For example, it can be used to find all features in a map that have values that violate a range domain.

This command works only on features in a layer and can't be applied to non-spatial tables. The table window provides an option to validate records while editing, but nothing is available to validate records after editing.

This sample provides a command that works like the validate selection command and can be applied to non-spatial tables. The command works in the row context menu of the table window and validates to the selected rows in the table.

How to use:
  1. Start ArcMap, and display the Customize Dialog.
  2. In the Customize dialog, click on Add from file and select this sample's dll.
  3. In the Customize dialog, Toolbars tab, check Context Menus. In the Context Menus toolbar that comes up, navigate to Context Menus; Table record marker context menu, and open it.
  4. Under the Commands tab of the Customize dialog, select the Validate Table Selection command from the 'Developer Samples' category and drag it onto the Table record marker context menu. Close the Customize dialog.
  5. If necessary, add a layer or table from a geodatabase to ArcMap and start editing.
  6. Right click a table or layer in the table of contents and choose either the open or the open attribute table command. This opens the table window.
  7. Select the rows to validate, right click a row in the table window and choose the Validate Table Selection command.


Difficulty: Beginner

Visual Basic
File Description
clsvaltabselection.cls Implementation of ArcMap command to validate selected rows in a table window.
prjvaltabselection.vbp VB project file for sample.
prjvaltabselection.dll Compiled project DLL.

Key CoClasses: TableView, TableWindow
Key Interfaces: IMxDocument, ITableView2, ITableWindow2, IApplicationWindows, IValidation, ISelectionSet