sujay.garapatis

add field

Discussion created by sujay.garapatis on Feb 24, 2011
Latest reply on Feb 25, 2011 by kenbuja
Hi,i am trying to add field using GP in arc engine but unable to add field, please help me how to add field, below is my code

Private Sub CreateField_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateField.Click
      

        Dim text As String = TextBox1.Text
        TextBox1.Text = text

        'get Field name from textbox
        Dim FName As String = FieldNameTxtB.Text
        FieldNameTxtB.Text = FName
        'get Field name from textbox
        Dim FAlias As String = FieldAliasTxtB.Text
        FieldAliasTxtB.Text = FAlias
        'get field type from combobox
        Dim FType As String = FieldTypeCMB.Text
        FieldTypeCMB.Text = FType
        'get field lenght as integer from textbox
        Dim FLength As Integer = Convert.ToInt32(FieldLengthTxtB.Text)



        Dim addfield As ESRI.ArcGIS.DataManagementTools.AddField = New ESRI.ArcGIS.DataManagementTools.AddField()

        addfield.in_table = text
        addfield.field_name = FName
        addfield.field_alias = FAlias
        addfield.field_type = FType
        addfield.field_length = FLength

        Dim pddfield As ESRI.ArcGIS.Geoprocessor.Geoprocessor = New ESRI.ArcGIS.Geoprocessor.Geoprocessor()
        pddfield.Execute(addfield, Nothing)
        MessageBox.Show("Completed")



    End Sub

Outcomes