Results 1 to 7 of 7

Thread: Not allowing user input in text box.

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    13

    Not allowing user input in text box.

    I am using a text box to display a list of items in which I want to be for reading only. Is there any way that I can not allow user input into this text box? Right now I have the text changed set to show an error message, that works but the text entered before the message box appears, still shows. Thanks for the help.

  2. #2
    Addicted Member
    Join Date
    Aug 2010
    Posts
    164

    Re: Not allowing user input in text box.

    Set the ReadOnly property to True

  3. #3
    Addicted Member
    Join Date
    Jan 2012
    Location
    Athens, Greece
    Posts
    143

    Re: Not allowing user input in text box.

    Why don't you use a label?

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,043

    Re: Not allowing user input in text box.

    I'd use a label. A textbox is there for entering or editing text. The user expects that if they see a textbox, then they should be allowed to interact with it. By showing them a textbox and preventing them from ever doing anything with it, you just frustrate learners, which is bad design. One thing you could do that would be somewhat better would be to disable the textbox. That would at least give the user some visual cue that they are not to be entering anything into the textbox. If you leave it enabled and do ANYTHING to prevent entry or editing, you will just annoy people.
    My usual boring signature: Nothing

  5. #5
    Junior Member
    Join Date
    May 2011
    Posts
    28

    Re: Not allowing user input in text box.

    If you're displaying a list of items it sounds like you should be using a listbox.

  6. #6

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    13

    Re: Not allowing user input in text box.

    I can't use a lable because my book tells me to use a text box. I would, rather use a lable believe me. Lol

  7. #7
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Not allowing user input in text box.

    As acrym's already pointed out, set the TB's ReadOnly property to True.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

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