Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim gp As ESRI.ArcGIS.Geoprocessor.Geoprocessor = New ESRI.ArcGIS.Geoprocessor.Geoprocessor Dim neartool As ESRI.ArcGIS.AnalysisTools.Near = New ESRI.ArcGIS.AnalysisTools.Near() neartool.in_features = "F:\Rajdeep-Assam\EQ_Source\FaultLine.shp" neartool.near_features = "F:\Rajdeep-Assam\EQ_Source\Epicentre_2011.1.1_20.48.shp" gp.OverwriteOutput = True gp.Execute(neartool, Nothing) MessageBox.Show("Done") End Sub End Class
When i run the code , it shows an error at the line gp.Execute(neartool, Nothing)
Error HRESULT E_FAIL has been returned from a call to a COM component.
Is that because you didn't set up the workspace? I am having the same issue while trying to use a customized tool in my c# code. I think the error means that the code is trying to access some object that is out of bound or can't be found. However it is too generic and doesn't help with debugging. I tried to find the usage and validate messages from the gp tool but with no avail. Anyone got a solution or suggestion on how to trouble shoot? Thanks!