I'm making a calculator in C# and i have a keypress event set up. It works and all I just want to know if theres a way to not display what key i press in the textbox. Thanks :)
keypress event help!!
Collapse
X
-
-
Implement your own event to handler to handle key press event. then call parent key event handler and return false so that it won't display ur keystroke.Comment
-
sorry for the last reply. it won't work in C#. i was thinking about some other programming language and mentioned it in previously reply.
Actual thing will something like below:
For example you want to suppress the key "i"
private void Form1_KeyDown(o bject sender, KeyEventArgs e)
{
if (e.KeyCode != Keys.i)
{
textbox1.Text = e.KeyCode;
// Don't pass message to other controls
e.Handled = true;
}
}
}Comment
Comment