ArcObjects Component Help  (Core)    

ISubtypes Interface

Provides access to members that return and modify subtype information.

Description

ISubtypes interface is a member of the ObjectClass coclass and is used to maintain information about subtypes for the object class. Subtypes can be removed, added, and retrieved using this interface. Also default subtypes and subtypecodes can be set for the object class here.

When To Use

The ISubtypes interface is the main interface for managing an object class' subtypes, default values and attribute domains. For example, use the ISubtypes interface to create new subtypes, delete subtypes and assign an attribute domain for a particular field of a subtype. ISubtypes is an interface on the ObjectClass co-class.

Members

Description
Method AddSubtype Adds the subtype to the set of associated subtypes.
Read/write property DefaultSubtypeCode The default subtype associated with the class.
Read/write property DefaultValue The default value for the associated attribute.
Method DeleteSubtype Deletes the subtype from the set of associated subtypes.
Read/write property Domain The domain given the subtype and field.
Read-only property HasSubtype Indicates if the table has subtypes.
Read-only property SubtypeFieldIndex The subtype field index.
Read/write property SubtypeFieldName The subtype field name.
Read-only property SubtypeName The subtype name.
Read-only property Subtypes The subtypes associated with the class.

CoClasses that implement ISubtypes

CoClasses and Classes Description
FeatureClass FeatureClass Object.
ObjectClass ObjectClass Object.
RouteEventSource Route event source object.
XYEventSource XY event source object.

Remarks

The following two examples are code excerpts that show how to get to an ISubtypes interface with Visual Basic for Applications and Visual Basic respecitvly.

When using VBA, you can use the table of contents in ArcMap to get at the feature class, then query interface (QI) for its ISubtypes interface.

 Dim pFeatcls As IFeatureClass
 Dim pFeatLayer As IFeatureLayer
 Dim pDoc As IMxDocument
 Dim pMap As IMap
 Dim pSubtypes As ISubtypes
   
 Set pDoc = ThisDocument
 Set pMap = pDoc.Maps.Item(0)
 Set pFeatLayer = pMap.Layer(0)
 Set pFeatcls = pFeatLayer.FeatureClass
 Set pSubtypes = pFeatcls

With Visual Basic, you are working outside of the application, so you need to use code to get the workspace object that contains the feature class, then get the feature class from there then QI for its ISubtypes interface. This example has the location of the connection file for the workspace hard-coded, but you could use the mini-browser to browse to the workspace, or the feature class.

Dim pFact As IWorkspaceFactory
 Set pFact = New SdeWorkspaceFactory
   
 Dim pWorkspace As IWorkspace
 Set pWorkspace = pFact.OpenFromFile("C:\MyConnections\redarrow_gdb.sde",0)
   
 Dim pFeatws As IFeatureWorkspace
 Set pFeatws = pWorkspace
   
 Dim pFeatcls As IFeatureClass
 Set pFeatcls = pFeatws.OpenFeatureClass("gdb.Buildings_net")
   
 Dim pSubtypes As ISubtypes
 Set pSubtypes = pFeatcls

You can QI (Query Interface) for the ISubtypes interface from interfaces on the following:

FeatureClass
ObjectClass
Table

Example

ISubtypes Example