C# auto highlight text in a textbox control

Total Post:101

Points:709
C# 
C#
 1883  View(s)
Ratings:
Rate this:
How do you auto highlight text in a textbox control when the control gains focus?
  1. Post:145

    Points:1019
    Re: C# auto highlight text in a textbox control

    Hi Pravesh,

    In Windows Forms and WPF:

    textbox.SelectionStart = 0;

    textbox.SelectionLength = textbox.Text.Length;

    Hope this will solve your problem.

      Modified On Apr-03-2018 05:46:28 AM

Answer