private void tb_Validating(object sender, CancelEventArgs e) { int index = (int)((TextBox)sender).Tag; clsTextBox BX = Boxes.Item(index); if (BX.Value() < BX.MinValue || BX.Value() > BX.MaxValue) { System.Media.SystemSounds.Exclamation.Play(); e.Cancel = true; } }
private void tb_Enter(object sender, EventArgs e) { int index = (int)((TextBox)sender).Tag; clsTextBox BX = Boxes.Item(index); double min = BX.MinValue; double max = BX.MaxValue; double Value = BX.Value(); using (var form = new FormNumeric(min, max, Value)) { var result = form.ShowDialog(); if (result == DialogResult.OK) { BX.TB.Text = form.ReturnValue.ToString(); } } }