Passing multiple values to the .NET Geoprocessor Class

Discussion created by juriggs on Apr 16, 2010
Latest reply on Apr 20, 2010 by elrobis

I've been working on a little issue for a few days now, and can't seem to identify the problem. Maybe a pair of fresh eyes can see what I'm missing.

What I'm trying to do is pass in multiple input values using the Geoprocessor class. I found a great article at


that explains how to do this, but there are two things I don't understand.

1) In all the examples, the author sets the parameters to physical locations such as "C:\temp\union_output.shp". That's fine, but I'd like to set my parameters to the value of a variable such as txtOutput.Txt. This doesn't seem to work - when I debug, there's nothing in the output workspace parameter.

2) This will take a bit more explaining. In the example, the author uses this code:

Example: Use a GpValueTableObject (probably the least widely known method, but very powerful!)

'Feature Class Objects

Dim gpUtils As IGPUtilities2 = New GPUtilitiesClass()
Dim inFeature1 As IFeatureClass = gpUtils.OpenFeatureClassFromString("C:\temp\test.gdb\states")
Dim inFeature2 As IFeatureClass = gpUtils.OpenFeatureClassFromString("C:\temp\test.gdb\counties")

'Create and populate a Value Table Object

Dim vt As IGpValueTableObject = New GpValueTableObjectClass()       
Dim obj1 As Object = inFeature1
Dim obj2 As Object = inFeature2

'Run the Tool

Dim union As ESRI.ArcGIS.AnalysisTools.Union = New ESRI.ArcGIS.AnalysisTools.Union()
union.in_features = vt
union.out_feature_class = "C:\temp\Union_Output.shp"
GP.Execute(union, Nothing)

In my application, I can have either feature classes or datasets as inputs. How will that change things? More importantly, the number of inputs is unknown. In this example, just creates 2 IFeatureClass variables. My input parameters are held in a listbox, and I need to be able to create as many variables as there are files. Could anybody point me in the right direction as to how I could code this?

Thanks for the help...