AnsweredAssumed Answered

Calculate Field VB.NET codeblock

Question asked by mrstephenbell on Sep 25, 2012
Latest reply on Sep 25, 2012 by mrstephenbell
Hi all,

I'm trying to run the Calculate Field geoprocessor tool in VB.NET, but it's not behaving.  Below is what I have.  I think it might be smth to do with the lines "test = ..." but I'm not sure.  I'm working in Arc9.3

Your thoughts would be appreciated.

Dim gp2 As Geoprocessor = New Geoprocessor()                 Dim CalcField As ESRI.ArcGIS.DataManagementTools.CalculateField = New ESRI.ArcGIS.DataManagementTools.CalculateField()                 CalcField.in_table = pflayer                 CalcField.field = "Fault"                 CalcField.expression_type = "VB"                 CalcField.expression = "text"                 CalcField.code_block = "Dim text as String" & vbNewLine & _ "If [LOWEST_VAL] >-3 Then" & vbNewLine & _ "text = """ & vbNewLine & _ "ElseIf (( ([INSIDE_EDI]<=-3) OR ([OUTSIDE_ED] <=-3) ) AND ( ([NEARSIDE_C]>-3) AND ([FARSIDE_CO] >-3))) Then " & vbNewLine & _ "text = Edilon" & vbNewLine & _ "ElseIf (( ([NEARSIDE_C]<=-3) OR ([FARSIDE_CO] <=-3)) AND (( [INSIDE_EDI]>-3) AND ([OUTSIDE_ED] >-3)) )Then " & vbNewLine & _ "text = Concrete" & vbNewLine & _ "ElseIf ((( [NEARSIDE_C]<=-3) OR ([FARSIDE_CO] <=-3)) AND ( ([INSIDE_EDI]<=-3) OR ([OUTSIDE_ED] <=-3)) )Then " & vbNewLine & _ "text = Both" & vbNewLine & _ "end if"                  gp2.Execute(CalcField, Nothing)

Outcomes