code:-

public void Get_errorprovider()

{

bool bb = true;

if (txt_name.Text==string .Empty )

{

errorProvider1.SetError(txt_name, "please enter Name");

bb = false;

}

}