how to restrict user input to a single character code example
Example: restrict user to enter specific characters in textbox
Restict user to input specific charector
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar)) //Checking if only number and delete.
{
e.Handled = true;
}
if (e.KeyChar == 46) //Allow Decimal
{
if (txbCashAmnt.Text.Contains(".")) // Checking if . already available
{
e.Handled = true;
}
else
e.Handled = false;
}