thanks for reply but i can use following code
private void actxtpincode_Validating(object sender, CancelEventArgs e)
{
Validatefivedigits(actxtpincode);
}
private void Validatefivedigits(TextBox actxtpincode)
{
if (actxtpincode.Text.Length != 6)
{
errorProvider1.SetError(actxtpincode, "Pincode must be six digits");
}
else
{
errorProvider1.SetError(actxtpincode, "");
}
}