I want to add a new field to my featureclass.My code for that is:
public IMxDocument mxDoc;
public IMap map;
IFieldEdit2 field = new FieldClass() as IFieldEdit2;
field.Name_2 = "Parcel_Way";
field.Type_2 = esriFieldType.esriFieldTypeString;
field.Length_2 = 50;
field.DefaultValue_2 = "Parcel";
IFeatureLayer2 flayer=map.Layer[cmboxLayer2.SelectedIndex] as IFeatureLayer2;
IFeatureClass featureclass = flayer.FeatureClass;
try
{
featureclass.AddField(field);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message, ex.Source);
throw;
}
Program return this error :
What do i neglecting ?