Hi all,
I am using one RichTextBox in C# Windows Application. I need to restrict the user from entering any key from keyboard at certain conditions. so, I wrote the following line of code in keydown event of RichTextBox at .
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
e.SuppressKeyPress = true;
}
This is working fine for English US keyboard. But when i changed my regional settings to Korea and keyboard language to Korean, i can enter the Korean characters (like ?????) even after executing the above statement.
even i have tried with the following code
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
e.SuppressKeyPress = true;
e.Handled = true;
}
but in vain.
Please help.
Thanks in advance. .
Loading

VulpesRank #55 · 29.2K reputationPosted Feb 13, 2012, 4:32 AM EST
Check this link for an example of the latter technique:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keypress.aspx
Sam HobbsRank #108 · 20.5K reputationPosted Feb 13, 2012, 12:18 PM EST
sampath kumar4 reputationPosted Feb 13, 2012, 7:54 PM EST
setting "Readonly" property of the richtextbox to true at selected conditions (where i supposed to suppress the key) and again making the "Readonly" property of the richtextbox to "false" in keyup event.
It meets the requirement. Now, it is working fine.
Thanks for your time.