Check out example codes for "restrict user to enter specific characters in textbox". It will help you in understanding the concepts better.
Code Example 1
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;
}
Learn ReactJs, React Native from akashmittal.com