Is This Content Helpful?
We're glad to know this article was helpful.
Why is an error returned when SetCurrentLayer is called after installing ArcGIS 9.3 Service Pack 1?
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.
Dim psubtypenum As ISubtypes
Dim subtype As Integer
If TypeOf pfeatClass Is ISubtypes Then
Set psubtypenum = pfeatClass
subtype = psubtypenum.DefaultSubtypeCode
subtype = 0
pEditLayers.SetCurrentLayer pFeatLayer, subtype