0

How to add a field in featureclass by using C# winform,arcobjects?

It means when we click on command winform should open and afetr field entries it should be add in to table.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Nov 7, 2014 at 5:47
1
  • Can you please post some code to show where you're stuck. You can use Windows Forms to access ArcObjects, either as an add-in or a standalone program (I would need to know which one it is) also, is it a local dataset or do you intend to do this over a web interface? Commented Nov 24, 2014 at 23:19

1 Answer 1

1

The following function will add a field to a feature class:

private void AddField(IFeatureClass fClass, string name, string alias, esriFieldType dataType)
{
 IField newField = new FieldClass();
 IFieldEdit fieldEdit = (IFieldEdit)newField;
 fieldEdit.Name_2 = name;
 fieldEdit.AliasName_2 = alias;
 fieldEdit.Type_2 = dataType;
 fClass.AddField(newField);
}

There are, of course, more properties that can be set on the field, this is just a sample of how to set them - the properties ending '_2' on IFieldEdit are the writable ones.

answered Dec 22, 2014 at 10:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.