GIS4SD

I can promatically Clipping but CAN'T Erase, please help me. (ArcEngine with VB.net)

Discussion created by GIS4SD on Sep 26, 2010
Latest reply on Oct 2, 2010 by GIS4SD
Dear helpers.
I would like to built an application with Erase and Clip (I use ArcEngine with Vb.net). I try some code and my code can CLip but can not Erase, I don't know why.
Would you please help me to correct code and explain me why?
Thank you very much for helping.

Following are my codes. (I have attached data files)

'=====================================================

Imports System.IO
Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.Controls
Imports ESRI.ArcGIS.ADF
Imports ESRI.ArcGIS.output
Imports ESRI.ArcGIS.SystemUI
Imports ESRI.ArcGIS.Geodatabase
'Imports ESRI.ArcGIS.Geoprocessing
Imports ESRI.ArcGIS.Geoprocessor
Imports ESRI.ArcGIS.AnalysisTools

Public Class MainForm
   Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
'==='Cliping===
        Dim ClipTool As ESRI.ArcGIS.AnalysisTools.Clip = New ESRI.ArcGIS.AnalysisTools.Clip()
        ClipTool.in_features = "E:\Temp\Road.shp"   'axMapControl1.Map.Layer(0) 
        ClipTool.clip_features = "E:\Temp\Boundary.shp"     'axMapControl1.Map.Layer(1)
        ClipTool.out_feature_class = "E:\Temp\clip_out.shp"

        Dim gp_clip As Geoprocessor = New Geoprocessor
        Dim resultsClip As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult = CType(gp_clip.Execute(ClipTool, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult)

       '''''=>> ResultsCLip is a   System.___Object

        '==='Earasing===

        Dim EraseTool As ESRI.ArcGIS.AnalysisTools.Erase = New ESRI.ArcGIS.AnalysisTools.Erase
        EraseTool.in_features = "E:\Temp\Road.shp"                ' axMapControl1.Map.Layer(0)
        EraseTool.erase_features = "E:\Temp\Boundary.shp"     'axMapControl1.Map.Layer(1)
        EraseTool.out_feature_class = "E:\Temp\Erase_out.shp"
        Dim gp_Erase As Geoprocessor = New Geoprocessor
        Dim resultsErase As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult = CType(gp_Erase.Execute(EraseTool, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult)

      '''''=>> ResultsErase is Nothing....Please why???

   End Sub
End Class
'==============
Ngo T
GIS for Sustainable Development,
Hanoi, Vietnam

Attachments

Outcomes