CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2008
    Posts
    3

    Hiding textbox text selection

    Has anybody been able to find a way to hide the selection of text in a textbox control? I need to use a textbox instead of a label and have already implemented the ability to hide the caret but cannot find a way to not show the selected text as being highlighted. Any help would be greatly apprecaited.

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Hiding textbox text selection

    Set the password character to *

    http://www.startvbdotnet.com/controls/textbox.aspx
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Hiding textbox text selection

    Aren't you looking for the HideSelection Property ¿

  4. #4
    Join Date
    Jul 2005
    Location
    E: 120°.6, N: 31°.3′
    Posts
    795

    Re: Hiding textbox text selection

    Change the UseSystemPasswordChar (progerty of textbox) to true.
    Little by little one goes far
    Keep moving.......!
    Nothing is impossible !

  5. #5
    Join Date
    Apr 2008
    Posts
    3

    Re: Hiding textbox text selection

    Tried all of these options and none seem to work. The control still enables a user to highlight the text inside of the textBox control when you click and drag the mouse to select the text of the textBox.

    There might be some confusion over what I am looking for. I am looking to disable the ability to (1) put the mouse in the textBox and/or (2) disable the ability to drag and select text that is in the textBox.

  6. #6
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Hiding textbox text selection

    If you have mentioned that in the first place, we would have known precisely what you wanted.

  7. #7
    Join Date
    Mar 2008
    Location
    Atlanta, GA
    Posts
    49

    Re: Hiding textbox text selection

    I'm curious as to why you can't use a label. I only use a textbox as a label for 2 circumstances:
    1) I need to a readonly display that will still allow the user to copy the data from the control.
    2) I need to limit the viewable area of the control through the use of scrollbars.

    I'm guessing you're dealing with number 2. If so, what's the problem with letting the user select some data out of the textbox? You can always set TabStop = false if that helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured