Input characters are formatted in uppercase (only letters are allowed)
public class Letterbox:radtextbox
{
#region ToUpper
public enum Touppers
{
False,
True,
}
private touppers To_upper;
[DefaultValue (Touppers.false)]
Public touppers To_upper
{
Get
{
return to_upper;
}
Set
{
to_upper = value;
}
}
#endregion
protected override void OnKeyPress (System.Windows.Forms.KeyPressEventArgs e)
{
Base. OnKeyPress (e);
Setstandard (e);
}
private void Setstandard (System.Windows.Forms.KeyPressEventArgs e)
{
//Allow only letters to be entered
regex regex = new Regex ("^[a-za-z]");
MatchCollection mc = regex. Matches (E.keychar.tostring ());
foreach (Match MA in MC)
{
e.handled = false;
return;
}
E.handled = true;
}
protected override void OnTextChanged ( EventArgs e)
{
base. OnTextChanged (e);
if (ToUppers.True.ToString () = = To_upper.tostring ())
{
This. Text = this. Text.toupper ();
This. Select (text.length, 0);
}
}
}
Format the input string in uppercase