Introduce only figures
-
There's an example of the code. I read MSDN about all the methods, properties. Copy that if the user introduces a numerator or BACKSPACE, the operator doesn't come in, If there's something else, like a letter, it works.
e.Handled = true;
And there's nothing in the textbox.Explain this line.
e.Handled = true;
I read about this parameter.KeyPressEventArgs
But I didn't understand whytrue
Notfalse
Then.private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.')) { e.Handled = true; } }
-
If it is true for the Handled control element, Handled textBox, this control element will not transmit events to the building block of Win32 text management, but it will display the symbols introduced by the user. Checked whether the keyboard was not representative of the figure. If the keyboard was pressed, the KeyPress event is cancelled by the Handled properties.
The value is true for circumventing the default; the value is false for the default control elements to be transmitted to the processor.