IVariantArray parameters = new VarArrayClass(); IGeoProcessor2 gp = new GeoProcessorClass(); try { gp.AddToolbox(@"C:\Program Files\ArcGIS\ArcPad10.0\DesktopTools10\ArcPad Tools.tbx"); //gp.AddToolbox(@"c:\program files\arcgis\desktop10.1\ArcToolbox\Toolboxes\Analysis Tools.tbx"); gp.SetEnvironmentValue("Workspace", @"C:\Documents and Settings\Administrateur\Mes documents\ArcGIS\Default.gdb"); parameters.Add(@"C:\Documents and Settings\Administrateur\Bureau\geo_db\test.axf"); //parameters.Add(@"C:\Documents and Settings\Administrateur\Mes documents\ArcGIS\Default.gdb\gone"); //parameters.Add(@"C:\Documents and Settings\Administrateur\Mes documents\ArcGIS\Default.gdb\gone_bif"); parameters.Add(""); parameters.Add(""); gp.Execute("ArcPadCheckin", parameters, null); /// the problem in this line } catch (Exception ex) { var sev = 2; label1.Text = label1.Text + gp.GetMessages(sev); label1.Text = label1.Text + ex.StackTrace; }
at ESRI.ArcGIS.Geoprocessing.GeoProcessorClass.IGeoProcessor2_Execute(String Name, IVariantArray ipValues, ITrackCancel pTrackCancel) at DesktopWindowsApplication2.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\Administrateur\Mes documents\Visual Studio 2010\Projects\DesktopWindowsApplication2\DesktopWindowsApplication2\Form1.cs:line 49Finished
object sev = 2; try { gp.Execute("ArcPadCheckin", parameters, null); MessageBox.Show(gp.GetMessages(ref sev)); } catch (Exception ex) { //var sev = 2; MessageBox.Show(gp.GetMessages(ref sev)); //label1.Text = label1.Text + gp.GetMessages(sev); label1.Text = label1.Text + ex.StackTrace; }
IGeoProcessor2 gp = new GeoProcessorClass(); object obj = 2; try { gp.AddToolbox(@"c:\program files\arcgis\desktop10.1\ArcToolbox\Toolboxes\Analysis Tools.tbx"); parameters.Add("gone_Buffer1"); parameters.Add("gone"); parameters.Add(@"C:\Documents and Settings\Administrateur\Mes documents\ArcGIS\Default.gdb\gone_Erase"); gp.Execute("Erase", parameters, null); MessageBox.Show( gp.GetMessages(ref obj)); //// this line is not executed } catch (Exception ex) { MessageBox.Show("in Except " + gp.GetMessages(ref obj)); /// this is the executed msgbox but it's empty "" // label1.Text = label1.Text + gp.GetMessages(obj); label1.Text = label1.Text + ex.StackTrace; }
gp.Execute("Erase_analysis", parameters, null);