Answers for "text box allow only letters and numbers"

0

Function that replaces character and allow only numbers into the textbox

This  technique we can use on the onkeyup property of HTML element

<input type="text" id="txtMobileNo"  
onkeyup="if (/D/g.test(this.value)) this.value = this.value.replace(/D/g,'')"
Posted by: Guest on May-07-2020
0

windows form textbox only allow numbers

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
    {
        e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
    }
Posted by: Guest on July-12-2021

Code answers related to "text box allow only letters and numbers"

Browse Popular Code Answers by Language