Add a field using the addfield method of ifeatureclass or the addfield method of itable
Private void add field toolstripmenuitem_click (Object sender, eventargs E)
{
Ifeaturelayer pfeaturelayer = player as ifeaturelayer;
Ifield field = new fieldclass ();
Ifieldedit fieldedit = field as ifieldedit;
Fieldedit. name_2 = "point ";
Fieldedit. type_2 = esrifieldtype. esrifieldtypedouble;
Pfeaturelayer. featureclass. addfield (field );
Openattribute (); // The method for opening the Attribute Table, which serves as a refresh.
}
To delete a field, you must first obtain the index of the deleted field, which can be obtained from the datagridview.
Private void Delete field toolstripmenuitem_click (Object sender, eventargs E)
{
Int Index = maid. columnindex; // get the column Index
Ifeaturelayer pfeaturelayer = player as ifeaturelayer;
Ifield field = pfeaturelayer. featureclass. Fields. get_field (INDEX );
MessageBox. Show (field. Name );
Pfeaturelayer. featureclass. deletefield (field );
Openattribute ();
}
Add and delete Fields