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


Get A SchematicDataSource In A Schematic Dataset Snippet (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference

Get A SchematicDataSource In A Schematic Dataset Snippet

Retrieve a SchematicDatasource in a given SchematicDataset from its name

[C#]
         
/// <summary>
/// Retrieve a SchematicElementClass in a given SchematicDataset from its name
/// </summary>
/// <param name="schemDataset">The SchematicDataset where the SchematicElementClass is stored</param>
/// <param name="ElementClassName">The name of the SchematicElementClass to retrieve</param>
/// <returns>The retrieved ESRI.ArcGIS.Schematic.ISchematicElementClass</returns>
        public ESRI.ArcGIS.Schematic.ISchematicDataSource GetSchematicElementClassFromSchematicDatasetByName(ESRI.ArcGIS.Schematic.ISchematicDataset schemDataset, string ElementClassName)
        {

                // cast SchematicDataset into ISchematicElementClassContainer
                ESRI.ArcGIS.Schematic.ISchematicElementClassContainer schDiagramCont=(ESRI.ArcGIS.Schematic.ISchematicElementClassContainer)schemDataset;

                return schDiagramCont.GetSchematicElementClass(ElementClassName);
        }
[Visual Basic .NET]
''' <summary>
''' Retrieve a SchematicDatasource in a given SchematicDataset from its name
''' </summary>
''' <param name="schemDataset">The SchematicDataset where the SchematicDataSource is referenced</param>
''' <param name="DataSourceName">The name of the SchematicDataSource to retrieve</param>
''' <returns>The retrieved ESRI.ArcGIS.Schematic.ISchematicDataSource</returns>
Public Function GetSchematicDataSourceFromSchematicDatasetByName(ByVal schemDataset As ESRI.ArcGIS.Schematic.ISchematicDataset, ByVal DataSourceName As String) As ESRI.ArcGIS.Schematic.ISchematicDataSource

       ' cast SchematicDataset into ISchematicDataSourceContainer
        Dim schDiagramCont As ESRI.ArcGIS.Schematic.ISchematicDataSourceContainer=TryCast(schemDataset, ESRI.ArcGIS.Schematic.ISchematicDataSourceContainer)

        Return schDiagramCont.GetSchematicDataSource(DataSourceName)
End Function

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