ArcGIS Developer Help  (GeoDatabase)    

ICodedValueDomain Interface

Provides access to members that return and modify coded value domain values.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

ICodedValueDomain interface maintains information about specific coded value domains that belong to the workspace domains. It provides functionality for adding and deleting codes from this domain and properties for retrieving information about this coded value domain.

When To Use

ICodedValueDomain is the interface on a CodedValueDomain object used to get and set the properties of a coded value domain object. For example, use the ICodedValueDomain interface when creating a new CodedValueDomain to add and remove valid coded values, and get a count of the number of valid values.


Members

Description
Method AddCode Adds a (value, name) code.
Read-only property CodeCount The number of codes for the associated attribute.
Method DeleteCode Deletes a code with the specified value.
Read-only property Name The code name for the specified code index.
Read-only property Value The value for the specified code index.

CoClasses that implement ICodedValueDomain

CoClasses and Classes Description
CodedValueDomain ESRI Attribute set constraint object.
[Visual Basic 6.0]
The following two examples are code excerpts that show how to get a reference to an ICodedValueDomain interface with Visual Basic for Applications and Visual Basic repectively.

When using VBA, you can use the table of contents in ArcMap to get at the workspace domains, then the coded value domains.
 Dim pFeatcls As IFeatureClass
 Dim pFeatLayer As IFeatureLayer
 Dim pDoc As IMxDocument
 Dim pMap As IMap
 
 Set pDoc = ThisDocument
 Set pMap = pDoc.Maps.Item(0)
 Set pFeatLayer = pMap.Layer(0)
 Set pFeatcls = pFeatLayer.FeatureClass
 
 Dim pWorkspace As IWorkspace
 Dim pWSDomains As IWorkspaceDomains
 
 Set pWorkspace = pFeatcls.FeatureDataset.Workspace
 Set pWSDomains = pWorkspace
 
 Dim pDomain As IDomain
 Set pDomain = pWSDomains.DomainByName("Building types")
 
 Dim pCodedValueDomain As ICodedValueDomain
 Set pCodedValueDomain = pDomain

With Visual Basic, you are working outside of the application, so you need to use code to get the workspace object that contains the coded value domain, then get the coded value domain from there. This example has the location of the SDE connection file hard-coded, but you could use the mini-browser to browse to the workspace.


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 pWSDomains As IWorkspaceDomains
Set pWSDomains = pWorkspace

Dim pDomain As IDomain
Set pDomain = pWSDomains.DomainByName("Building types")

Dim pCodedValueDomain As ICodedValueDomain
Set pCodedValueDomain = pDomain

Example

ICodedValueDomain Example

 


Feedback Send feedback on this page