public void Attach(ProgramPropertiesDialog dlg) { this.dlg = dlg; dlg.Load += dlg_Load; dlg.EnableScript.CheckedChanged += delegate { EnableControls(); }; dlg.OkButton.Click += OkButton_Click; }