How to bring the cursor to the end of text in the textbox control – WPF C#

Normally if we focus a textbox control the cursor would be in the start of the textbox.But when there is text already in the textbox it would be annoying if the cursor is in start.It would be better if the cursor is at the end of content in texbox.

Thus to position the cursor at the end of the text content of a textBox control,we have to call the select method and specify the selection start position to the length of the text and a selection length to 0.

txtExample.focus();
txtExample.Select(txtExample.Text.Length, 0);

Ref : msdn

Popularity: 7% [?]

Related posts:

  1. set focus on textbox value at the end
  2. Make Textbox Number Only – WPF
  3. Set textbox background color when clicked
  4. How to Text Wrap a Label in WPF?
  5. How do you create a Thread
You can leave a response, or trackback from your own site.

Leave a Reply

Designed by: Business Web Hosting | Thanks to Buy Icons, travel tips and Used Cars