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


Loop On The Schematic Datasources In A Schematic Dataset Snippet (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference

Loop On The Schematic Datasources In A Schematic Dataset Snippet

Looping on all the schematic datasources referenced in a given schematic dataset

[C#]
/// <summary>
/// Looping on all the schematic datasources referenced in a given SchematicDataset
/// </summary>
/// <param name="schemDataset">The SchematicDataset where the schematic datasources are referenced</param>
public void SchematicDataSourceFromSchematicDataset(ESRI.ArcGIS.Schematic.ISchematicDataset schemDataset)
{
    // cast SchematicDataset into ISchematicDataSourceContainer
    ESRI.ArcGIS.Schematic.ISchematicDataSourceContainer schDataSourceCont=(ESRI.ArcGIS.Schematic.ISchematicDataSourceContainer)schemDataset;

    // retrieve all the SchematicDatasource in the schematic dataset container
    ESRI.ArcGIS.Schematic.IEnumSchematicDataSource enumDataSource=schDataSourceCont.SchematicDataSources;
    enumDataSource.Reset();

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

        if (isOk) break;

        // get the next SchematicDataSource
        schDataSource=enumDataSource.Next();
}
}
[Visual Basic .NET]
''' <summary>
''' Looping on all the schematic datasources referenced in a given SchematicDataset
''' </summary>
''' <param name="schemDataset">The SchematicDataset where the schematic datasources are referenced</param>
Public Sub SchematicDataSourceFromSchematicDataset(ByVal schemDataset As ESRI.ArcGIS.Schematic.ISchematicDataset)
    ' cast SchematicDataset into ISchematicDataSourceContainer
    Dim schDataSourceCont As ESRI.ArcGIS.Schematic.ISchematicDataSourceContainer=TryCast(schemDataset, ESRI.ArcGIS.Schematic.ISchematicDataSourceContainer)

    ' retrieve all the SchematicDatasource in the schematic dataset container
    Dim enumDataSource As ESRI.ArcGIS.Schematic.IEnumSchematicDataSource=schDataSourceCont.SchematicDataSources
    enumDataSource.Reset()

    ' get the first SchematicDataSource
    Dim schDataSource As ESRI.ArcGIS.Schematic.ISchematicDataSource=enumDataSource.Next()
    Dim isOk As Boolean=False
    While (schDataSource IsNot Nothing)
        ' TODO: add your code here, set isOk to true to exit the loop
        If (isOk) Then Exit While ' quit loop if you have finish

        ' get the next SchematicDataSource
        schDataSource=enumDataSource.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