TX Text Control .NET Server

GetItem Method

Method|Introduced in 15.1
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK as TXTextControl.Core.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

Gets a particular text frame from the collection.

Syntax

GetItem()

Gets the text frame selected by the user or null if no text frame is selected.

public TextFrame GetItem();

GetItem(int)

Gets the text frame with the specified identifier.

public TextFrame GetItem(int id);
ParameterDescription
id

Specifies the text frame's identifier set with the ID property. The method returns null if a text frame with the specified identifier does not exist.

GetItem(string)

Gets the text frame with the specified name.

public TextFrame GetItem(string name);
ParameterDescription
name

Specifies the text frame's name set with the Name property. The method returns null if a text frame with the specified name does not exist.

Return Value

The return value is null, if a text frame with the specified parameters could not be found. Otherwise, it is an object of the type TextFrame.

Examples

The following example works with text frames in the current document by using TextFrameCollection.GetItem.

TextFrameCollection textFrameCollection = textControl.TextFrames;
textFrameCollection.Add(new TextFrame(new System.Drawing.Size(3000, 1200)) { Name = "Callout", ID = 100 }, TextFrameInsertionMode.DisplaceText);

var result = textFrameCollection.GetItem(100);
Console.WriteLine($"Get Item result: {result}");