Genius.Boy wrote:
Is there a way to restrict users to input only numbers in TextBox control
Yes their is a way....
all u have to do is copy paste this piece of code in the key press event of your textbox where u want only numbers to appear and you are done, now lets say you are validating for mobile numbers then
private void txtmobile_KeyPress(object sender, KeyPressEventArgs e)
{
if (char.IsNumber(e.KeyChar) == false)
{
e.Handled = true;
}
if (e.KeyChar == (char)Keys.Back)
{
e.Handled = false;
}
}
do rate my answer once you find it useful
Thanks & regards
Radix :rose: