C# AUTO HIGHLIGHT TEXT IN A TEXTBOX CONTROL

Pravesh Singh

Total Post:101

Points:709
Posted by  Pravesh Singh
C# 
C#
 1540  View(s)
Ratings:
Rate this:
How do you auto highlight text in a textbox control when the control gains focus?
  1. ezra heywood

    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-04-2016 11:23:51 PM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!