Form Form2 = new Form2(this); Form2.ShowDialog();
public partial class Form2 : Form { Form1 Parent; public Form2(Form1 f) { InitializeComponent(); Parent = f; } .... Parent.button1.Enabled=true; this.close ....
Form1 frm = new Form1(true);
public Form1(bool enableButton) { InitializeComponent(); button1.enabled=enableButton; ... }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionpublic class Form1 { public void EnableButton() { button1.enabled=true; } public Form1() { InitializeComponent(); button1.enabled=false; // inhibé par défaut à la création ... } ... }
Form1 frm = new Form1(); frm.Show();
frm.EnableButton();