Description
Replaces selected text in the edit control for the current row and column with a specified string.
Applies to
Syntax
PowerBuilder
long editname.ReplaceText ( string string )
Argument |
Description |
---|---|
editname |
A reference to a DataWindow control |
string |
The string that replaces the selected text |
Return value
Returns the number of characters in string and -1 if an error occurs.
If any argument's value is null, the method returns null.
Usage
If there is no selection, ReplaceText inserts the replacement text at the cursor position.
To use the contents of the clipboard as the replacement text, call the Paste method instead of ReplaceText.
PowerBuilder environment
For use with other PowerBuilder controls, see the section called “ReplaceText” in PowerScript Reference.
Examples
If the DataWindow edit control contains "Offer Good for 3 Months" and the selected text is "3 Months", this statement replaces "3 Months" with "60 Days" and returns 7. The resulting text in the edit control is "Offer Good for 60 Days":
dw_salesoffer.ReplaceText("60 Days")
If there is no selected text, this statement inserts "New product" at the cursor position in the edit control for dw_products:
dw_products.ReplaceText("New product")
See also
ReplaceText in the the section called “ReplaceText” in PowerScript Reference