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.
-
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?Michael Stimson– Michael Stimson2014年11月24日 23:19:47 +00:00Commented Nov 24, 2014 at 23:19
1 Answer 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
lang-cs