How can I block the space key when writing over a text field to prevent the user from entering a space when registering something? I currently control only letters and numbers in the Keypress. I need no field to be sent to the database with spaces.
//letras y numeros
if (Char.IsLetter(e.KeyChar))
{
e.Handled = false;
}
else if (Char.IsDigit(e.KeyChar))
{
e.Handled = false;
}
else if (Char.IsControl(e.KeyChar))
{
e.Handled = false;
}
else if (Char.IsSeparator(e.KeyChar))
{
e.Handled = false;
}
else
{
e.Handled = true;
}