Solid Edge Framework Type Library
Documents Property
Solid Edge Framework Type Library > Application Object : Documents Property
Description
Returns the collection of documents that are owned by the referenced Application object.
Property type
Read-only property
Syntax
Visual Basic
Public Property Documents As Documents
Example
Option Infer On

Imports System
Imports System.Runtime.InteropServices

Namespace Examples
    Friend Class Program
        <STAThread>
        Shared Sub Main(ByVal args() As String)
            Dim application As SolidEdgeFramework.Application = Nothing

            Try
                ' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
                OleMessageFilter.Register()

                ' Attempt to connect to a running instance of Solid Edge.
                application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)

                ' Get the documents collection.
                Dim documents = application.Documents

                ' Iterate through the collection.
                For i As Integer = 1 To documents.Count
                    Dim document = CType(documents.Item(i), SolidEdgeFramework.SolidEdgeDocument)
                Next i
            Catch ex As System.Exception
                Console.WriteLine(ex)
            Finally
                OleMessageFilter.Unregister()
            End Try
        End Sub
    End Class
End Namespace
using System;
using System.Runtime.InteropServices;

namespace Examples
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            SolidEdgeFramework.Application application = null;

            try
            {
                // See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
                OleMessageFilter.Register();

                // Attempt to connect to a running instance of Solid Edge.
                application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");

                // Get the documents collection.
                var documents = application.Documents;

                // Iterate through the collection.
                for (int i = 1; i <= documents.Count; i++)
                {
                    var document = (SolidEdgeFramework.SolidEdgeDocument)documents.Item(i);
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                OleMessageFilter.Unregister();
            }
        }
    }
}
See Also

Application Object  | Application Members