The FieldDefinition.Set method sets the field definition for an attribute field of a document feature layer. You cannot update an existing field's field type or modify a web feature layer field definition.
Declaration
public bool Esri.ArcGISForAutoCAD.FieldDefinition.Set(Document doc, string flName, string name, string sublayerName = null, int? length = null, IConvertible value = null, bool? readOnly = null)
Parameters
| Type | Name | Description | Required |
|---|---|---|---|
Document | doc | The AutoCAD document to act on. | Required |
string | flName | An existing feature layer name in the drawing. | Required |
string | name | The field name. | Required |
string | sublayerName | An existing feature layer sublayer name in the drawing. When setting the field definition of a sublayer, only set the default value. | Optional |
int | length | The field length for text fields only. | Optional (set to UI defaults) |
IConvertible | value | The default field value. | Optional (set to UI defaults) |
bool | readOnly | Specifies whether the new field is read-only. true = read-only | Optional |
Returns
| Type | Value Description |
|---|---|
bool | true if the field definition was set successfully |
Remarks on error conditions
This method may throw an exception or return false or null if a parameter is invalid.
Example
Print the success of updating the definition of the Location field from the Parks feature layer.// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
// Update the field definition
var success = Esri.ArcGISForAutoCAD.FieldDefinition.Set(doc, "Parks", "Location", null, 254, "CA");
// Print the success
doc.Editor.WriteMessage(success.ToString());
/* Example output
True
*/
See also
esri_fielddef_set—An AutoLISP function that sets a field definition.