This document is archived and information here might be outdated.  Recommended version.


IEditTemplate.SetDefaultValue Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Carto)  

IEditTemplate.SetDefaultValue Method

Sets the default value for the given field. If the field is a subtype field it will use initDefaultValues.

[Visual Basic .NET]
Public Sub SetDefaultValue ( _
    ByVal Field As String, _
    ByVal Value As Object, _
    ByVal initDefaultValues As Boolean _
)
[C#]
public void SetDefaultValue (
    string Field,
    object Value,
    bool initDefaultValues
);
[C++]
HRESULT SetDefaultValue(
  BSTR Field,
  VARIANT Value,
  VARIANT_BOOL initDefaultValues
);
[C++]

Parameters Field [in] Field is a parameter of type BSTR Value [in] Value is a parameter of type VARIANT initDefaultValues [in] initDefaultValues is a parameter of type VARIANT_BOOL

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

Sets the value of a given field to the supplied value.


An exception will be raised if the supplied value is not valid for the given field type e.g. If you try to set a text value for an integer field.

For subtype fields, the supplied value can either be the integer code or the text description. When initdefaultvalues is true the default values for that subtype are used to set the default values for other fields. Initdefaultvalues has no effect on non-subtype fields.

See Also

IEditTemplate Interface

.NET Related Topics

Using feature templates