private void MasterGainTextBox_TextChanged(object sender, EventArgs e) { double value; if (Double.TryParse(MasterGainTextBox.Text, out value)) { if (MasterGainTextBox.Focused) { controller.MasterGainChanged(CavityName, value); } } }