how can i make my input to be all capital only?
and disable special character?
thank you.
Printable View
how can i make my input to be all capital only?
and disable special character?
thank you.
Hi, try this.
Code:public Form1()
{
InitializeComponent();
textBox1.KeyPress+=new KeyPressEventHandler(textBox1_KeyPress);
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(char.IsLetterOrDigit(e.KeyChar) || (Keys)e.KeyChar == Keys.Back))
{
e.Handled = true;
}
e.KeyChar = char.ToUpper(e.KeyChar);
}
For the casing you could set the CharacterCasing property of the control to Upper instead of the default Normal.
I always recommend checking to see what members a class has before asking questions. The answers are often obvious but you have to look first. If nothing obvious presents itself, then ask.
thanks sir.