My program is generating a default string for a textbox and selects a part of it which is likely to be modified by the user.
After the Text of a TextEdit is changed (programatically), the next time it gets the focus it will automatically select all the text in the editor, despite of what SelectionStart and SelectionLength have been set to.
Here's a sample to demonstrate it:
private void labelControl1_Click(object sender, EventArgs e)
{
// set and then change the text
this.textEdit1.Text = "";
this.textEdit1.Text = "FooBar";
this.textEdit1.SelectionStart = 3;
this.textEdit1.SelectionLength = 3;
this.textEdit1.Focus();
// without further action, the whole "FooBar" becomes selected
this.textEdit1.SelectionStart = 3;
this.textEdit1.SelectionLength = 3;
this.textEdit1.Focus();
// now only "Bar" is selected
}