In C# 2005 (.net 2.0) there is a new control Masked TextBox that supports a declarative syntax for accepting or rejecting user input.

Article