Replace

[method icon] Replace(sSearch$, sReplace$)

Method to replace all occurences of a field with the replacement text

sSearch$ String The search string to be replaced
sReplace$ String The replacement string

Applies to: Rich Edit


>Replace

Replace

The Replace() method is used to replace the contents of the first string with the second string within a Rich Text control. The method actually searches for the search string surrounded by two pairs of braces, for example "{{STRING}}".

This method is designed to allow functions such as a mail merge to be formed. Where a standard letter template is loaded into the control containing search text for each of the items to be merged, i.e. {{ADDRESSLINE1}}, {{TOWN}}, {{CITY}}, {{POSTCODE}} etc. The replace methods for this strings would then be something of the form:

.rtfControl1.Replace("ADDRESSLINE1", dbAddressLine1$)
.rtfControl1.Replace("TOWN", dbTown$)
.rtfControl1.Replace("CITY", dbCity$)
.rtfControl1.Replace("POSTCODE", dbPostcode$)

See also

Rich Edit methods, properties and events.