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


Loop On The Schematic Diagrams In A Schematic Folder Snippet (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference

Loop On The Schematic Diagrams In A Schematic Folder Snippet

Looping on all the schematic diagrams in a schematic folder

[C#]
        /// <summary>
        /// Looping on all the schematic diagrams in a schematic folder
        /// </summary>
        /// <param name="schemDataset">The ISchematicFolder where the schematic diagrams are stored</param>
        public void SchematicDiagramFromSchematicFolder(ESRI.ArcGIS.Schematic.ISchematicFolder schemFolder)
        {
                // cast SchematicFolder into ISchematicDiagramContainer
                ESRI.ArcGIS.Schematic.ISchematicDiagramContainer schDiagramCont=(ESRI.ArcGIS.Schematic.ISchematicDiagramContainer)schemFolder;

                // get all the schematic diagrams
                ESRI.ArcGIS.Schematic.IEnumSchematicDiagram enumDiagram=schDiagramCont.SchematicDiagrams;
                enumDiagram.Reset();

                // get the first schematic diagram
                ESRI.ArcGIS.Schematic.ISchematicDiagram schDiagram=enumDiagram.Next();
                bool isOk=false;
                while (schDiagram != null)
                {
                        // TODO: add your code here, set isOk to true to exit the loop

                        if (isOk) break;

                        // get the next schematic diagram
                        schDiagram=enumDiagram.Next();
                }
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Looping on all the schematic diagrams in a schematic folder
        ''' </summary>
        ''' <param name="schemFolder">The ISchematicFolder where the schematic diagrams are stored</param>
        Public Sub SchematicDiagramFromSchematicFolder(ByVal schemFolder As ESRI.ArcGIS.Schematic.ISchematicFolder)

                ' cast SchematicFolder into ISchematicDiagramContainer
                Dim schDiagramCont As ESRI.ArcGIS.Schematic.ISchematicDiagramContainer=TryCast(schemFolder, ESRI.ArcGIS.Schematic.ISchematicDiagramContainer)

                ' get all the schematic diagrams
                Dim enumDiagram As ESRI.ArcGIS.Schematic.IEnumSchematicDiagram=schDiagramCont.SchematicDiagrams
                enumDiagram.Reset()

                ' get the first schematic diagram
                Dim schDiagram As ESRI.ArcGIS.Schematic.ISchematicDiagram=enumDiagram.Next()
                Dim isOk As Boolean=False
                While (schDiagram IsNot Nothing)

                    ' TODO: add your code here, set isOk to true to exit the loop

                    If (isOk) Then Exit While

                    ' get the next schematic diagram
                    schDiagram=enumDiagram.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