This is the code I write that only accepts numbers or only characters. I dk the way that can only limit the user can only write the input from 0000 to FFFF only.
Please Guide me Thank You
public partial class TextBox_Numbers_Characters : Form
{
public TextBox_Numbers_Characters()
{
InitializeComponent();
}
private void TXTB_ONLY_CHAR_KeyPress(object sender, KeyPressEventArgs e)
{
if(!char.IsControl(e.KeyChar) && !char.IsLetter(e.KeyChar))
{
e.Handled = true;
}
}
private void TXTB_ONLY_NUMBER_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
{
e.Handled = true;
}
}