CanAdd Property
- 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
Gets a value indicating whether a new document target can be inserted at the current text input position. It is true if a target can be inserted, otherwise it is false.
Syntax
public bool CanAdd { get; }Public ReadOnly Property CanAdd As BooleanExamples
The following example works with document targets in the current document by using DocumentTargetCollection.CanAdd.
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
DocumentTargetCollection documentTargetCollection = textControl.DocumentTargets;
documentTargetCollection.Add(new DocumentTarget("CustomerDetails") { ID = 100 });
if (documentTargetCollection.CanAdd)
{
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
documentTargetCollection.Add(New DocumentTarget("CustomerDetails") With { .ID = 100 })
If documentTargetCollection.CanAdd Then
If Not documentTargetCollection.Add(New DocumentTarget("CustomerName")) Then
Throw New InvalidOperationException("The item could not be inserted.")
End If
End IfLimitations
Read only.