Home > DeveloperSection > Forums > C# auto highlight text in a textbox control
Pravesh Singh
Pravesh Singh

Total Post:101

Posted on    November-13-2013 7:40 AM

 C# C# 

 1 Reply(s)
 1237  View(s)
Rate this:
How do you auto highlight text in a textbox control when the control gains focus?

ezra heywood
ezra heywood

Total Post:145

Posted on    November-13-2013 7:43 AM

Hi Pravesh,

In Windows Forms and WPF:

textbox.SelectionStart = 0;

textbox.SelectionLength = textbox.Text.Length;

Hope this will solve your problem.

Modified On Apr-04-2016 11:23:51 PM

Don't want to miss updates? Please click the below button!

Follow MindStick