110,567
社区成员
发帖
与我相关
我的任务
分享
private void UcTextBox_Validating(object sender, CancelEventArgs e)
{
this.Text = this.Text.Trim();
m_ErrorProvider.Clear();
if (this.Text.Length < m_MinLength || this.Text.Length > this.MaxLength)
{
m_ErrorProvider.SetError(this, string.Format("长度应在{0}位至{1}位之间!", m_MinLength, MaxLength));
this.Focus();
e.Cancel = true;
}
else
{
m_ErrorProvider.Clear();
e.Cancel = false;
}
}