Generating parameter lists for tools in Arc10

571
1
11-09-2011 10:16 AM
TylerQuick
New Contributor
I am trying to create a custom tool in AcrMap 10 that baically allows me to do a select by attribute within the tool.  I have a database of river features and want to select features using the river name listed in a column in the attribute table.  I can get the tool to the point where, when run, it will prompt me for river name and I can manually type it in and that works, but is there a way to populate a list of options for the parameter so I don't have to know the exact form of the river name to use the tool?  Any help would be appreciated.
0 Kudos
1 Reply
GeorgeFaraj
Occasional Contributor III
If you just want to read the data  from your feature layer then dataStatistics.UniqueValues can be walked using .MoveNext() after this query:


ICursor cursor = geoFeatureLayer.Search( null, false ) as ICursor;
IDataStatistics dataStatistics = new DataStatisticsClass();
dataStatistics.Field = fieldName;
dataStatistics.Cursor = cursor;
dataStatistics.UniqueValues.Reset();


The fieldName would be the RiverName field (or whatever it is called.)

I should add that if a MapControl is passed as your hookhelper then you can pass data to the tool or command using the CustomProperty field.
0 Kudos