?
Solved

Stop Hightlight on Focus of Multiline Textbox

Posted on 2007-07-19
4
Medium Priority
?
245 Views
Last Modified: 2010-04-15
I have a windows app with a multiline textbox which I load a text file into.

If I try to set focus on the textbox all the text is highlighted.  How do I stop that from happening when set the focus on that control.

Thanks for the help.
0
Comment
Question by:sneeri_c
  • 2
  • 2
4 Comments
 
LVL 19

Expert Comment

by:drichards
ID: 19527578
When you set the focus, also set SelectionLength to 0.
0
 

Author Comment

by:sneeri_c
ID: 19527655
How do I set the selection length
0
 
LVL 19

Accepted Solution

by:
drichards earned 2000 total points
ID: 19527665
           textBox1.SelectionLength = 0;

Of course, replace textBox1 with the name of your TextBox control.

I assume you are using

            textBox1.Focus();

to set the focus?
0
 

Author Comment

by:sneeri_c
ID: 19527798
Perfect...thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question