English

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

Question

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

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