so i have turned my ITable into an editable DataGridview from this post
link.
Now i want to set some of the columns to be non editable. So what I can do is initially set my IFieldEdit.Editable_2 to false, and the column would be read only.
However, when I tried to do that and actually populate values into my field initially, it throws me exception for not editable.
So I was wondering if anyone know if i can temporary set the field to editable and then after setValue , set the editable to false again.
I have this but doesn't work:
bool fieldEditable = featureClass.Fields.get_Field(x).Editable;
IFieldEdit fieldEdit = (IFieldEdit)featureClass.Fields.get_Field(x);
fieldEdit.Editable_2 = true;
featureBuffer.set_Value(x, cegObject.GetPropertyValue(featureClass.Fields.get_Field(x).Name));
fieldEdit.Editable_2 = fieldEditable
However, the setting to true, does not work. Is there a way around this? Or is editable totally useless cause once i make a field editable, i can't even populate a value in? But i'm sure i'm just not doing it right, please help.
Thanks and Regards,
Kevin
Best Answer
If you create a field which is non-editable via ArcObjects or some other method, you will not be able to edit it (never) without changing the schema, which requires a lock.
I'm not sure if you can revert non-editable fields to editable via ArcObjects.
If you are concerned that a certain user will edit a field by hand, just disable that column on your UI and keep the field editable if you need to insert (calculated) values.