ActiveReports Developer 7
InsertField Method
See Also  Example
GrapeCity.ActiveReports.v7 Assembly > GrapeCity.ActiveReports.SectionReportModel Namespace > RichTextBox Class : InsertField Method

fieldName
Specifies a unique name to be used when to reference this field in the ReplaceField method.

Glossary Item Box

Inserts a RichTextBox merge field into the current location in the text.

Syntax

Visual Basic (Declaration) 
Public Sub InsertField( _
   ByVal fieldName As System.String _
) 
C# 
public void InsertField( 
   System.string fieldName
)

Parameters

fieldName
Specifies a unique name to be used when to reference this field in the ReplaceField method.

Remarks

You can use the InsertField method to create mail-merged content when the text is added to the RichTextBox control at run time.  Inserting a mail-merge field adds brackets around the field name and sets the text to protected.

Example

C#Copy Code
private void ghCustomerID_Format(object sender, System.EventArgs eArgs)
{
    this.rtf.ReplaceField("CompanyName", "m_companyName");
    this.rtf.ReplaceField("ContactName", "m_contactName");
    this.rtf.ReplaceField("AddressLine", "m_addressLine");
    this.rtf.ReplaceField("City", "m_city");
    this.rtf.ReplaceField("Region", "m_region");
    this.rtf.ReplaceField("Country", "m_country");
    this.rtf.ReplaceField("PostalCode", "m_postalCode");
    this.rtf.ReplaceField("Date", System.DateTime.Today.Date.ToString());    
    this.rtf.InsertField("CustomerID");
}
Visual BasicCopy Code
Private Sub ghCustomerID_Format(ByVal sender As Object, ByVal e As System.EventArgs) Handles ghCustomerID.Format
    Me.rtf.ReplaceField("CompanyName", "m_companyName")
    Me.rtf.ReplaceField("ContactName", "m_contactName")
    Me.rtf.ReplaceField("AddressLine", "m_addressLine")
    Me.rtf.ReplaceField("City", "m_city")
    Me.rtf.ReplaceField("Region", "m_region")
    Me.rtf.ReplaceField("Country", "m_country")
    Me.rtf.ReplaceField("PostalCode", "m_postalCode")
    Me.rtf.ReplaceField("Date", System.DateTime.Today.Date)
    Me.rtf.InsertField("CustomerID")
End Sub

See Also

Reference

RichTextBox Class
RichTextBox Members
ActiveReports6~GrapeCity.ActiveReports.RichTextBox~ReplaceField