IMPORTANT!!!
I didn't realize ASP.Net tag! I'm sorry!:(
Limiting maximum length of string is simple, go to Properties Window and look for MaxLength property
or
myTextBox.MaxLength = 10;
At most of times I check my input on KeyPress event.
myTextBox.KeyPress += delegate(object sender, KeyPressEventArgs e)
{
if (!IsMyCharOk(e.KeyChar))
{
e.Handled = true;
}
};