---
title: "C# auto highlight text in a textbox control"  
description: "C# auto highlight text in a textbox control"  
author: "Anonymous User"  
published: 2013-11-13  
updated: 2013-11-13  
canonical: https://www.mindstick.com/forum/1723/c-sharp-auto-highlight-text-in-a-textbox-control  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# C# auto highlight text in a textbox control

How do you [auto](https://www.mindstick.com/forum/33810/remote-view-in-android-auto-cancel-custom-notification) highlight [text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions) in a [textbox control](https://www.mindstick.com/forum/155820/how-to-generate-textbox-control-using-htmlhelper-in-razor-view) when the control gains [focus](https://yourviews.mindstick.com/audio/1251/how-music-can-improve-your-focus-and-mood)?

## Replies

### Reply by Anonymous User

**Hi Pravesh,**\

In Windows Forms and WPF:

[textbox](https://www.mindstick.com/forum/12714/dynamic-textbox-in-gridview).SelectionStart = 0;

textbox.SelectionLength = textbox.Text.Length;

Hope this will solve your problem.


---

Original Source: https://www.mindstick.com/forum/1723/c-sharp-auto-highlight-text-in-a-textbox-control

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
