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


IEditLayers.SetCurrentLayer Method (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Editor)  

IEditLayers.SetCurrentLayer Method

The editor's target layer and subtype for new features.

[Visual Basic .NET]
Public Sub SetCurrentLayer ( _
    ByVal layer As IFeatureLayer, _
    ByVal subtype As Integer _
)
[C#]
public void SetCurrentLayer (
    IFeatureLayer layer,
    int subtype
);

Product Availability

Available with ArcGIS Desktop.

Remarks

Use this method to set the editor's current layer. Use the CurrentLayer property to check the current layer. The current layer is the layer that new features are typically written to. For example, the CreateNewFeature Task, the Buffer command, and the CopyParallel command all create new features and store them in the current layer. Custom tools and tasks do not have to model this behavior. All layers that return TRUE for IsEditable, are editable simulataneously. To edit features in a particular layer, you do not have to call the SetCurrentLayer method for that layer.

If you want to set the current layer to a layer that does not have subtypes, use a zero for the required subtype index parameter.

Each time this property is set, a new empty geometry is automatically created in the Editor object and is accessable through IEditSketch::Geometry. The type of geometry created is equal to that of the layer. This default behavior is easily overrideable by setting IEditSketch::Geometry manually; this does not affect the CurrentLayer property.

See Also

IEditLayers Interface