This document is archived and information here might be outdated.  Recommended version.


Loop On The Schematic Element Associations Related To A Schematic Element Class Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Loop On The Schematic Element Associations Related To A Schematic Element Class Snippet

Looping on all the schematic element associations for a given schematic element class

[C#]
        /// <summary>
        /// Looping on all the Schematic Element Associations of a SchematicElementClass
        /// </summary>
        /// <param name="schemElementClass">The SchematicElementClass on which you want to work</param>
        public void SchematicElementAssociationFromElementClass(ESRI.ArcGIS.Schematic.ISchematicElementClass schemElementClass)
        {
                // cast SchematicElementClass into ISchematicElementAssociationContainer
                ESRI.ArcGIS.Schematic.ISchematicElementAssociationContainer schElementAssociationCont=(ESRI.ArcGIS.Schematic.ISchematicElementAssociationContainer)schemElementClass;

                // get all the related Schematic Element Associations
                ESRI.ArcGIS.Schematic.IEnumSchematicElementAssociation enumElementAssociation=schElementAssociationCont.SchematicElementAssociations;
                enumElementAssociation.Reset();

                // get the first SchematicElementAssociation
                ESRI.ArcGIS.Schematic.ISchematicElementAssociation schElementAssociation=enumElementAssociation.Next();
                bool isOk=false;
                while (schElementAssociation != null)
                {
                        // TODO: add your code here, set isOk to true to exit the loop

                        if (isOk) break;

                        // get the next SchematicElementAssociation
                        schElementAssociation=enumElementAssociation.Next();
                }
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Looping on all the Schematic Element Associations of a SchematicElementClass
        ''' </summary>
        ''' <param name="schemElementClass">The SchematicElementClass on which you want to work</param>
        Public Sub SchematicElementAssociationFromElementClass(ByVal schemElementClass As ESRI.ArcGIS.Schematic.ISchematicElementClass)

                ' cast SchematicElementClass into ISchematicElementAssociationContainer
                Dim schElementAssociationCont As ESRI.ArcGIS.Schematic.ISchematicElementAssociationContainer=TryCast(schemElementClass, ESRI.ArcGIS.Schematic.ISchematicElementAssociationContainer)

                ' get all the related Schematic Element Associations
                Dim enumElementAssociation As ESRI.ArcGIS.Schematic.IEnumSchematicElementAssociation=schElementAssociationCont.SchematicElementAssociations
                enumElementAssociation.Reset()

                ' get the first SchematicElementAssociation
                Dim schElementAssociation As ESRI.ArcGIS.Schematic.ISchematicElementAssociation=enumElementAssociation.Next()
                Dim isOk As Boolean=False
                While (schElementAssociation IsNot Nothing)
                        ' TODO: add your code here, set isOk to true to exit the loop

                        If (isOk) Then Exit While

                        ' get the next SchematicElementAssociation
                        schElementAssociation=enumElementAssociation.Next()
                End While
        End Sub

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Schematic