Home > Language Reference > Classes > Field
InsertText Method
Inserts text in the field at the current cursor position, or replaces the current selection.
Syntax
Public Sub InsertText(ByRef sText As String)
| Parameter | Description |
| sText | Text to insert. |
Remarks
The InsertText method replaces the selected text with the text specified by the sText parameter. If no text is selected, the text is inserted at the current cursor position. If the text field does not have the focus and if the cursor is not active, the text is inserted at the end.
This method posts Change events in the internal message queue. If you repeatedly call this method without returning control to the system, the queue can overflow and cause a non-recoverable error.
If the length of the text resulting from the insertion is greater than the maximum size specified by the MaxChar property, if the field is non-editable or if you attempt to insert non-numeric text in a numeric field, the insertion is not carried out.
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | - |
| Windows CE | Windows CE 3.0 | - |