I'm trying to create a function that sets an Error Provider on my forms from one class, that way if something changes with it, I can change it in one spot, not 20.
Here's my function:
and the statement that's causing the error is:
Any ideas?
Here's my function:
Code:
public void SetError(DevExpress.XtraEditors.XtraForm frm, System.Windows.Forms.Control ctrl, string sErrorMessage, bool IsGroupControlVisible)
{
DevExpress.XtraEditors.GroupControl gc = (DevExpress.XtraEditors.GroupControl)frm.Controls.Find("gcError", true)[0];
System.Windows.Forms.Label lbl = (System.Windows.Forms.Label)frm.Controls.Find("lblError", true)[0];
System.Windows.Forms.ErrorProvider ep = (System.Windows.Forms.ErrorProvider)frm.Controls.Find("epError", true)[0];
ep.SetError(ctrl, sErrorMessage);
if (lbl.Text.Length > 0)
lbl.Text += "\n" + sErrorMessage;
else
lbl.Text = sErrorMessage;
gc.Visible = IsGroupControlVisible;
}
Code:
System.Windows.Forms.ErrorProvider ep = (System.Windows.Forms.ErrorProvider)frm.Controls.Find("epError", true)[0];
[i]
Cannot implicitly convert type System.Windows.Forms.Control to System.Windows.Forms.ErrorProvider
[/i]
Any ideas?