public static void UpdateFromButton(object sender) { if (!(sender is Button)) { return; } Button button = sender as Button; if (!(button.Tag is Control)) { return; } Control control = button.Tag as Control; NumericInputForm form = new NumericInputForm(); form.NumberEntered = int.Parse(control.Text); if (form.ShowDialog() == DialogResult.OK) { control.Text = form.NumberEntered + ""; } }
private void ButtonNumericInput_Click(object sender, EventArgs args) { NumericInputForm.UpdateFromButton(sender); }