method Edit.InsertText (Text as String, [Index as Variant])
Inserts text to control.

 TypeDescription 
   Text as String A string expression being inserted.  
   Index as Variant A long expression that defines the index of line where the text follows to be inserted.  

Use the InsertText method to add programmatically new lines to the control. Use the DeleteLine method to delete a particular line. Use the Text property to clear the control's text. If the Text contains multiple cr lf sequences multiple lines are inserted. Checks the control's MultiLine property when multiple lines are accepted. Use the SelText property to insert text at cursor position.

The following VB sample inserts a line at the top:

Edit1.InsertText "top line" + vbCrLf, 1

The following C++ sample inserts a line at the top:

m_edit.InsertText( "top line\r\n", COleVariant( long(1) ) );

The following VB.NET sample inserts a line at the top:

AxEdit1.InsertText("top line" + vbCrLf, 1)

The following C# sample inserts a line at the top:

axEdit1.InsertText("top line\r\n", 1);

The following VFP sample inserts a line at the top:

with thisform.Edit1
	.InsertText("top line" + chr(13) + chr(1), 1)
endwith

 


Send comments on this topic.
1999-2016 Exontrol.COM, Software. All rights reserved.