comp • gb.qt4.ext • textedit • insert

TextEdit.Insert (gb.qt4.ext)

Sub Insert ( Text As String )

Insert the specified text at the cursor position.

Note: this will only insert plain text not processed html code.

To insert html code use the RichText property of .TextEdit.Selection or set the .TextEdit.Format style before inserting.

Eg.

Using TextEdit.Insert() method...

  TextEdit1.Insert("This text <font color=blue>has some blue</font> in it.")

Will insert..
This text <font color=blue>has some blue</font> in it.

Using TextEdit.Selection.RichText property...

  TextEdit1.Selection.RichText = "This text <font color=blue>has some blue</font> in it."

Will insert the following at cursor position..
This text has some blue in it.

This is the equivalent of having a TextEdit.InsertRichText() method.

Using TextEdit..TextEdit.Format property...

  TextEdit1.Insert("This text ")
  Dim iCurrentColor = TextEdit1.Format.Color
  TextEdit1.Format.Color = Color.Blue
  TextEdit1.Insert("has some blue")
  TextEdit1.Format.Color = iCurrentColor
  TextEdit1.Insert(" in it.")

Will insert the following..
This text has some blue in it.