public class MyTextBox : TextBox
{
public MyTextBox() : base()
{}
public void RaiseValidatedEvent()
{
OnValidated( EventArgs.Empty );
}
public override string Text
{
get {
return base.Text;
}
set {
CancelEventArgs e = new CancelEventArgs();
OnValidating(e); //引发Validating事件以检查数据
if( !e.IsCancel )
{
base.Text=value;
OnValidated(EventArgs.Empty);
}
}
}
}