Edward Munya

Edward Munya

  • NA
  • 20
  • 0

Event Handling between forms in C#

Nov 20 2012 8:40 AM

I am dealing with 2 forms. A child form and a parent form.
I want to enable a textbox on a parent form immediately when a child form closes.
Below are codes and error messages I got. Please any idea would be appreciated.


public class ChildForm: Form
{
    public delegate SomeEventHandler(object sender, EventArgs e);
    public event SomeEventHandler SomeEvent;

    
}
The above code is for child form

and again below codes are for parent form:

public class ParentForm : Form
{
    frmCaptureFingerPrint child = new frmCaptureFingerPrint();
    child.SomeEvent += new EventHandler(this.HandleSomeEvent);

    public void HandleSomeEvent(object sender, EventArgs e)
    {
        this.textBox1.enabled=true;
    }
}
Please need your help
I get a error message that:

Cannot implicitly convert type 'System.EventHandler to CaisseSec....SomeEventHandler

Answers (5)