Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TextBox tb = new TextBox();
- this.Controls.Add(tb);
- private void tb_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) )
- {
- e.Handled = true;
- }
- }
- tb.KeyPress += tb_KeyPress;
- TextBox tb = new TextBox();
- tb.KeyPress += tb_KeyPress; //add this
- this.Controls.Add(tb);
- private void tb_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) )
- {
- e.Handled = true;
- }
- }
Add Comment
Please, Sign In to add comment