Click to See Complete Forum and Search --> : Help. ErrorProvider with Databinding not showing Options


comicrage
February 7th, 2008, 09:16 AM
Hi,

I added an errorprovider to my GUI layer and databinded to my business object

bindingSource1.DataSource = MyBusinessObject;

NameTextBox.SetDataBindings("Text", bindingSource1, "NameProperty", true, DataSourceUpdateMode.OnPropertyChanged);

The property is the followign


public string NameProperty
{
get { return m_name; }
set
{
m_name= value;
PropertyHasChanged("NameProperty");
PropertyHasChanged("VerifyPersonName");
}
}

The
PropertyHasChanged("VerifyPersonName");

will check if the textbox.text value is null or empty.

public bool VerifyPersonName(object target, RuleArgs e)
{
if (string.IsNullOrEmpty(m_name.Trim()))
{
e.Description = "Empty Field";
return false;
}
return true;
}


When I clear the Name textbox field, i see the e.Description is called. However, the errorprovider is not visible on the GUI.

Any help is appreciated.

Thanks