I used the following linked to the TextChanged event:
private void labelDescription_TextChanged(object sender, EventArgs e)
{
int noCharacters = labelDescription.Text.Count();
if (noCharacters > 50)
{
errorProvider.SetError(labelDescription, "Please review your description and shorten to a maximum of 50 characters.");
}
else
{
errorProvider.SetError(labelDescription, null);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…