Stop Hightlight on Focus of Multiline Textbox

Posted on 2007-07-19
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.
Question by:sneeri_c
    LVL 19

    Expert Comment

    When you set the focus, also set SelectionLength to 0.

    Author Comment

    How do I set the selection length
    LVL 19

    Accepted Solution

               textBox1.SelectionLength = 0;

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

    I assume you are using


    to set the focus?

    Author Comment


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now