Solid Edge FrameworkSupport Type Library
Count Property
Description
Returns the number of objects in the referenced collection.
Property type
Read-only property
Syntax
Visual Basic
Public Property Count As Long
Example
Imports System
Imports System.Collections.Generic
Imports System.Runtime.InteropServices

Namespace Examples
    Friend Class Program
        <STAThread>
        Shared Sub Main(ByVal args() As String)
            Dim application As SolidEdgeFramework.Application = Nothing
            Dim documents As SolidEdgeFramework.Documents = Nothing
            Dim draftDocument As SolidEdgeDraft.DraftDocument = Nothing
            Dim sheet As SolidEdgeDraft.Sheet = Nothing
            Dim textBoxes As SolidEdgeFrameworkSupport.TextBoxes = Nothing
            Dim textBox As SolidEdgeFrameworkSupport.TextBox = 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)
                documents = application.Documents
                draftDocument = CType(documents.Add("SolidEdge.DraftDocument"), SolidEdgeDraft.DraftDocument)
                sheet = draftDocument.ActiveSheet
                textBoxes = CType(sheet.TextBoxes, SolidEdgeFrameworkSupport.TextBoxes)

                textBox = textBoxes.AddByTwoPoints(0.1, 0.1, 0, 0.2, 0.2, 0)

                For i As Integer = 1 To textBoxes.Count
                    textBox = textBoxes.Item(i)
                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.Collections.Generic;
using System.Runtime.InteropServices;

namespace Examples
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            SolidEdgeFramework.Application application = null;
            SolidEdgeFramework.Documents documents = null;
            SolidEdgeDraft.DraftDocument draftDocument = null;
            SolidEdgeDraft.Sheet sheet = null;
            SolidEdgeFrameworkSupport.TextBoxes textBoxes = null;
            SolidEdgeFrameworkSupport.TextBox textBox = 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");
                documents = application.Documents;
                draftDocument = (SolidEdgeDraft.DraftDocument)documents.Add("SolidEdge.DraftDocument");
                sheet = draftDocument.ActiveSheet;
                textBoxes = (SolidEdgeFrameworkSupport.TextBoxes)sheet.TextBoxes;

                textBox = textBoxes.AddByTwoPoints(0.1, 0.1, 0, 0.2, 0.2, 0);

                for (int i = 1; i <= textBoxes.Count; i++)
                {
                    textBox = textBoxes.Item(i);
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                OleMessageFilter.Unregister();
            }
        }
    }
}
See Also

TextBoxes Collection  | TextBoxes Members