79300122

Date: 2024-12-21 21:17:31
Score: 1
Natty:
Report link

The event handler shouldn't be static.

public void Form1_ListenToChanges(MyUserControl sender)

And the event subscription should be effected in the Form1 class.

public Form1()
{
    // ...
    this.myUserControl.Value_Change += this.Form1_ListenToChanges;
}

(Form1 has a MyUserControl, right? The code snippet above assumes that it does and that it is this.myUserControl.)

(You can then make the event handler private.)

private void Form1_ListenToChanges(MyUserControl sender)
Reasons:
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: jeremydalmer