Clear

Clears selected text or other contents of a specified control.

To clear

Use

Selected text from a specified control

Syntax 1 For edit and list box controls

The contents of a Signature control

Syntax 2 For Signature controls


Syntax 1 For edit and list box controls

Description

Deletes selected text from the specified control, but does not store it in the clipboard.

Applies to

DataWindow, EditMask, MultiLineEdit, SingleLineEdit, RichTextEdit, DropDownListBox, DropDownPictureListBox, OLE controls, and OLEStorage objects

Syntax

objectname.Clear ( )

Argument

Description

objectname

One of the following:

  • The name of the control from which you want to delete (clear) selected text.

  • The name of an OLE control or storage object variable (type OLEStorage) from which you want to release its OLE object.

If objectname is a DropDownListBox its AllowEdit property must be true.

Returns

Long.

For edit controls, returns the number of characters that Clear removed from objectname. If no text is selected, no characters are removed and Clear returns 0. If an error occurs, Clear returns -1.

If objectname is null, Clear returns null.

Usage

To select text for deleting, the user can use the mouse or keyboard. You can also call the SelectText function in a script.

To delete selected text and store it in the clipboard, use the Cut function.

Examples

Example 1

If the text in sle_comment1 is Draft and it is selected, this statement clears Draft from sle_comment1 and returns 5:

sle_comment1.Clear()

Example 2

If the text in sle_comment1 is Draft, the first statement selects the D and the second clears D from sle_comment1 and returns 1:

sle_comment1.SelectText(1,1)

sle_comment1.Clear()

See also


Syntax 2 For Signature controls

Description

Clears the contents of the control.

Applies to

Signature controls

Syntax

void controlname.Clear ( )

Argument

Description

controlname

The name of the signature control you want to clear

Returns

None

Examples

Example 3

This statement clears the contents of the signature control sig_1:

sig_1.clear()