public MyForm() { InitializeComponent(); if (alreadyOpened != null) { alreadyOpened.Close(); alreadyOpened = this; } }
static public FormResult Exec(string parm1, string parm2) { var result = new FormResult(); var me = new MyForm(); me.parm1 = parm1; me.parm2 = parm2; result.dr = me.ShowDialog(); if (result.dr == DialogResult.OK) { result.LastName = me.LastName; result.FirstName = me.FirstName; } me.Close(); // should use try/finally or using clause return(result); }
private void boton_Click(object sender, EventArgs e) { this.Valor = (int)Entrada.Value; MyForm.Close(); }