Friday, July 29, 2005

C# Set Cursor Position in Textbox

How does one go about setting the cursor position in a .NET CF TextBox?

You use a combination of the TextBox.SelectionStart and TextBox.SelectionLength.

For example,

private void textBox1_GotFocus(object sender, System.EventArgs e)
{
textBox1.SelectionStart = 5;
textBox1.SelectionLength = 0;
}


from groups.google.

No comments: