Auto highlight text in a textbox control

c#, textbox

Solution

In Windows Forms and WPF:

textbox.SelectionStart = 0;
textbox.SelectionLength = textbox.Text.Length;

Problem

How do you auto highlight text in a textbox control when the control gains focus.

Original source

Related problems