belowzero8

ITableSelection in a map document

Discussion created by belowzero8 on Dec 2, 2013
Latest reply on Dec 4, 2013 by belowzero8
I have an add-in tool for arcmap that is basically a customized selection tool.  I have it working just fine for feature class selections, but I cannot seem to get it to show the Table selections in the map document.  This is the method I have for the table selections:

private void SelectTableFeaturesByAttributeQuery(IStandaloneTable standAloneTable, string whereClause, bool addToSelection)
{
   // a selection cannot be done if any of these are empty
   if (activeView == null || standAloneTable == null || whereClause == null) return;

   ITableSelection tableSelection = (ITableSelection)standAloneTable;

   // Set up the query
   IQueryFilter queryFilter = new QueryFilterClass();
   queryFilter.WhereClause = whereClause;

   // Perform the selection
   try
   {
      if (addToSelection)
         tableSelection.SelectRows(queryFilter, esriSelectionResultEnum.esriSelectionResultAdd, false);
      else
         tableSelection.SelectRows(queryFilter, esriSelectionResultEnum.esriSelectionResultNew, false);
   }
   catch (Exception ex)
   {
      // taken out, not relevant
   }

   tableSelection.SelectionChanged();
}


When I run this on a table it runs without an error, but does not show the selection in the tables once it is complete.  What am I missing?

Outcomes