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


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

Loop On The Schematic Folders In A Schematic Folder Snippet

Looping on all the schematic folders in another schematic folder

[C#]
        /// <summary>
        /// Looping on all the schematic folders in another schematic folder
        /// </summary>
        /// <param name="schemFolder">The ISchematicFolder on which you want to work</param>
        public void SchematicFolderFromSchematicFolder(ESRI.ArcGIS.Schematic.ISchematicFolder schemFolder)
        {
                // cast SchematicFolder into ISchematicFolderContainer
                ESRI.ArcGIS.Schematic.ISchematicFolderContainer schemFolderCont=(ESRI.ArcGIS.Schematic.ISchematicFolderContainer)schemFolder;

                // get all the schematic folders
                ESRI.ArcGIS.Schematic.IEnumSchematicFolder enumFolder=schemFolderCont.SchematicFolders;
                enumFolder.Reset();

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

                        if (isOk) break;

                        // get the next schematic folder
                        schFolder=enumFolder.Next();
                }
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Looping on all the schematic folders in another schematic folder
        ''' </summary>
        ''' <param name="schemFolder">The ISchematicFolder on which you want to work</param>
        Public Sub SchematicFolderFromSchematicFolder(ByVal schemFolder As ESRI.ArcGIS.Schematic.ISchematicFolder)

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

                ' get all the schematic folders
                Dim enumFolder As ESRI.ArcGIS.Schematic.IEnumSchematicFolder=schFolderCont.SchematicFolders
                enumFolder.Reset()

               ' get the first schematic folder
                Dim schFolder As ESRI.ArcGIS.Schematic.ISchematicFolder=enumFolder.Next()
                Dim isOk As Boolean=False
                While (schFolder IsNot Nothing)
                        ' TODO: add your code here, set isOk to true to exit the loop

                        If (isOk) Then Exit While

                        ' get the next schematic folder
                        schFolder=enumFolder.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