Add Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. Core. SDK TXTextControl.from the private NuGet feed or Text Control Offline PackagesCore. dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXTextControl.dll
Description
Inserts the specified target at the current text input position.
Syntax
public bool Add(DocumentTarget documentTarget);Public Function Add(documentTarget As DocumentTarget) As BooleanParameters
| Parameter | Description |
|---|---|
| documentTarget | Specifies the document target to add. |
Return Value
The return value is true, if the document target could be added. Otherwise it is false.
Examples
The following example works with document targets in the current document by using DocumentTargetCollection.Add.
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
DocumentTargetCollection documentTargetCollection = textControl.DocumentTargets;
if (!documentTargetCollection.Add(new DocumentTarget("CustomerName")))
{
throw new InvalidOperationException("The item could not be inserted.");
}textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim documentTargetCollection As DocumentTargetCollection = textControl.DocumentTargets
If Not documentTargetCollection.Add(New DocumentTarget("CustomerName")) Then
Throw New InvalidOperationException("The item could not be inserted.")
End If