Inserts (pastes) the contents of the clipboard into the specified control. For editable controls, text on the clipboard is pasted at the insertion point. For OLE controls, the OLE object on the clipboard replaces any object already in the control.
EditMask, MultiLineEdit, SingleLineEdit, RichTextEdit, DropDownListBox, DropDownPictureListBox, DataWindow, OLE controls
controlname.Paste ( )
Argument |
Description |
---|---|
controlname |
The name of the control into which you want to insert the contents of the clipboard. If controlname is a DataWindow, text is pasted into the edit control over the current row and column. If controlname is a DropDownListBox the AllowEdit property must be true |
Long. If controlname is null, Paste returns null.
For edit controls, returns the number of characters that were pasted into controlname. If nothing has been cut or copied (the clipboard is empty), the Paste function does not change the contents of the edit control and returns 0. If the clipboard contains nontext data (for example, a bitmap or OLE object) and the control cannot accept that data, Paste does not change the contents and returns 0.
For editable controls, if text is selected in controlname, Paste replaces the text with the contents of the clipboard. If the clipboard contains more lines than fit in the edit control, only the number of lines that fit are pasted.
In a DataWindow control, the text is pasted into the edit control over the current row and column. If the clipboard contains more text that is allowed for that column, the text is truncated. If the clipboard text does not match the column’s datatype, all the text is truncated, so that any selected text is replaced with an empty string.
To insert a specific string in controlname or to replace selected text with a specific string, use the ReplaceText function.
If the clipboard contains Proposal
good for 90 days
and no text is selected, this
statement pastes Proposal good for 90 days
in mle_Comment1 at
the insertion point and returns 25:
mle_Comment1.Paste()
If the clipboard contains the string Final
Edition
, mle_Comment2 contains This
is a Preliminary Draft
, and the text in mle_Comment2 is
selected, this statement deletes This is a Preliminary
Draft
, replaces it with Final
Edition
, and returns 13:
mle_Comment2.Paste()