PrintCancel  ReselectRow

Chapter 9: Methods for the DataWindow Control

ReplaceText

Description

Replaces selected text in the edit control for the current row and column with a specified string.

Syntax

long editname.ReplaceText ( string string ) 

Argument

Description

editname

A reference to a DataWindow control

string

The string that replaces the selected text

Returns

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.

NoteUsing with other controls For use of this method with other PocketBuilder controls, see ReplaceText in the PowerScript Reference.

Examples

Example 1

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")

Example 2

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





Copyright © 2004. Sybase Inc. All rights reserved. ReselectRow

View this book as PDF