示例#1
0
        private void Tb_TextChanged(object sender, EventArgs e)
        {
            var        tb   = sender as Control;
            StringRule rule = ruleMap[tb];

            if (rule.Pass(tb.Text))
            {
                errorProvider.SetError(tb, "");
                return;
            }
            else
            {
                errorProvider.SetError(tb, rule.Hint);
                UnvalidatedInput?.Invoke(tb, rule);
            }
        }