Frequently asked question

Why is an error returned when SetCurrentLayer is called after installing ArcGIS 9.3 Service Pack 1?

Last Published: April 25, 2020

Answer

At ArcGIS 9.3 Service Pack 1, the SetCurrentLayer method found on the IEditLayers interface has been changed, so that it requires a valid layer and subtype value. An error will be raised if an invalid subtype code is passed. The exception to this change is when a shapefile is the current layer, a subtype value of 0 can be passed, because shapefiles do not support subtypes.

Use the following code to set the current layer when unsure of the default subtype.
Code:
Dim psubtypenum As ISubtypes
Dim subtype As Integer
If TypeOf pfeatClass Is ISubtypes Then
Set psubtypenum = pfeatClass
subtype = psubtypenum.DefaultSubtypeCode
Else
subtype = 0
End If
pEditLayers.SetCurrentLayer pFeatLayer, subtype

Article ID:000010276

Software:
  • ArcMap

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic