Provides access to members that return and modify coded value domain values.
| Description | ||
|---|---|---|
![]() |
AddCode | Adds a (value, name) code. |
![]() |
CodeCount | The number of codes for the associated attribute. |
![]() |
DeleteCode | Deletes a code with the specified value. |
![]() |
Name | The code name for the specified code index. |
![]() |
Value | The value for the specified code index. |
| CoClasses and Classes | Description |
|---|---|
| CodedValueDomain | ESRI Attribute set constraint object. |
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