我有 100 个文本框,分布在 20 种形式中,它们都在 EditValueChanged 上做同样的事情。这些是 DevExpress.XtraEditors.TextEdit 控件
ParentForm
ChildForm1
TextBox1
this.line1TextEditSubscriber.EditValueChanged += new System.EventHandler(PropertyEditValue);
TextBox2
this.line1TextEditSubscriber.EditValueChanged += new System.EventHandler(PropertyEditValue);
TextBox3
this.line1TextEditSubscriber.EditValueChanged += new System.EventHandler(PropertyEditValue);
DropDow1
ChildForm2
TextBox1
this.line1TextEditSubscriber.EditValueChanged += new System.EventHandler(PropertyEditValue);
TextBox2
this.line1TextEditSubscriber.EditValueChanged += new System.EventHandler(PropertyEditValue);
TextBox3
this.line1TextEditSubscriber.EditValueChanged += new System.EventHandler(PropertyEditValue);
DropDow1
public delegate void PropertyChangedEventHandler(object sender, EventArgs e);
//This one method is declared on the Parent Form.
private void PropertyEditValue(object sender, EventArgs e)
{
//Do some action
}
有没有办法可以在每个 ChildForms Textboxe EditValueChanged 中访问父表单的 PropertyEditValue 方法
this.line1TextEditSubscriber.EditValueChanged += new System.EventHandler(PropertyEditValue);