Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

ITableSelection in a map document

$
0
0
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:

Code:

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?

Viewing all articles
Browse latest Browse all 1374

Trending Articles