I have a function like this which checks whether the field is empty or what and if empty then get the setError icon aside the textbox.
private bool ValidateHost()
{
ErrorProvider errorProvider = new ErrorProvider();
bool isValid = true;
//If the txtHost is empty, show a message to user
if(txtHost.Text == string.Empty)
{
errorProvider.SetError(txtHost, "Please enter the host address");
isValid = false;
}
else
errorProvider.SetError(txtHost, string.Empty);
return isValid;
}
but when I tried to use string,isnullorempty then I am not getting the seterror icon.. Can you guys plz tell me what is the proper way of using string.isnullorempty in this case..
if(string.IsNullOrEmpty(txtHost.Text)).