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.
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.
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.