用户界面的设计
验证
l Validating(), Validated()
l CF 支持常见的表达式
l System.Text.RegularExpressions.RegEx
Ø Regex.IsMatch()
l if(!Regex.IsMatch(userName,"^([a-zA-Z])+$"))
l{
l MessageBox.Show(“User Name is invalid.”);
l}

| The Compact Framework provides the same validation process with Validating and Validated events for most controls.
| It also supports regular expressions through the System.Text.RegularExpressions namespace.
| Within this namespace is the Regex class, which allows you to validate a data string against a regular expression string using the IsMatch method. The example here checks to see if a string contained in the userName variable contains only letters. Regular expressions provide a mechanism for performing complex validations with very little code, resulting in smaller applications.