Selecting and Formatting Text

Text editing from code works similar to using mouse and menus. To change a word to bold, you would normally select it with the mouse, and then click on the Bold button. From code, you use a Text Control's Selection object to 'highlight' a word, and then set the Selection.Bold property.

[C#]
textControl1.Text = "TX Text Control";
textControl1.Selection.Start = 3;
textControl1.Selection.Length = 4;
textControl1.Selection.Bold = true;
[Visual Basic]
TextControl1.Text = "TX Text Control"
TextControl1.Selection.Start = 3
TextControl1.Selection.Length = 4
TextControl1.Selection.Bold = True

Next >>