c# - Suppress the display of the input into the TextBox -


i have winforms program containing richtextbox. user inputs text richtextbox. wish receive input through keyboard events , not through textbox1.text property, validate string , display in richtextbox later. how can prevent richtextbox displaying input text user, though user inputs text richtextbox? richtextbox selected , has focus. sorry. wanted simplify issue , therefore neglected mention it not textbox richtextbox. turns out matters, proposed solution based on passowrdchar property, not natively supported richtextbox. not wish create inherited class property not being used such, suppress displaying user input @ input time.

you can use keydown event. doing that, have ability validate user input.

tutorial

private void textbox1_keydown(object sender, keyeventargs e) {     //     // detect keyeventarg's key enumerated constant.     //     if (e.keycode == keys.enter)     {     messagebox.show("you pressed enter! job!");     }     else if (e.keycode == keys.escape)     {     messagebox.show("you pressed escape! what's wrong?");     } } 

with said, have store user input in string variable, validate through event , set variable value in textbox.


Comments