In my UserControl i have a TextBox Which is not inheriting from TextBox, i am doing a
validation for Numerics (which allows only Digits)
public delegate void usercontrolError(string message);
public event usercontrolError onerror;
Private void txtLocl_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar != '\b')
{
if(!char.IsDigit(e.KeyChar))
{
e.Handled=true;
}
else
{
onerror.Invoke("Enter Digits Only");
}
}
}
in Form i write the following code
public Form1()
{
txtLocl.onerror += new ciscontrols.UserControl.usercontrolError(mtbDtTmPk1_onerror);
}
void UserControl_onerror(string message)
{
epfrm2.SetError(mtbDtTmPk1, message);
//throw new NotImplementedException();
}
i write the above code in Form. now i don't want to write any code in Form. But errorProvider is in Form1 only. How can i do Know. User cann't write any code in Form1.But Form ErrorProvider will work.