Random programming things I'd want to remember

Wednesday, February 19, 2014

Select all text in TextBox using C#

Here is what worked for me today:
    txtContent.SelectionLength = txtContent.Text.Length;
It does not work if the TextBox does not have focus. There are other solutions, but this one is quick and easy.

No comments: