Reputation: 699
I have a RichTextBox
that is focusable when the program begins. After the user types in a certain number of characters, I want to stop them from changing/adding/etc anything else to the text box.
Originally I wrote this as a Java app and used userInputBox.setFocusable(false)
, but I cannot find an equivalent way to programatically change this in C#. I am building a Windows Forms application. I don't have any other container or object that I want the user to interact with so I cannot use whatever.Focus()
to pull it away from my text box. Thanks.
Upvotes: 0
Views: 280
Reputation: 44374
Setting ReadOnly = true
or Enabled = false
should do the trick, unless you really need the control to be unfocusable, in which case Oded has a good answer.
Upvotes: 1