private void buttonDebugSetCriticalLow_Click(object sender, EventArgs e) { byte ch; float value, gain; if (checkBoxDebugUseDefGain.Checked) { // Use gain that is inferred from configuration file try { ch = InputValidatorHelperClass.GetChModeFromComboBox(comboBoxDebugSetCritLow); value = float.Parse(textBoxDebugSetCriticalLow.Text); if (ch == 0) { gain = ConfigClass.deviceGainCH0; } else { gain = ConfigClass.deviceGainCH1; } value = value / gain; } catch (Exception) { MessageBox.Show("Insert valid values!"); return; } } else { // Use gain that is parsed from textbox try { ch = InputValidatorHelperClass.GetChModeFromComboBox(comboBoxDebugSetCritLow); value = float.Parse(textBoxDebugSetCriticalLow.Text); gain = float.Parse(textBoxDebugSetCriticalLowGain.Text); value = value / gain; } catch (Exception) { MessageBox.Show("Insert valid values!"); return; } } com.AppendSetCriticalLow(value, ch); textBoxDebugInstructionPool.Text += "SetCriticalLow(" + value + ", " + comboBoxDebugSetCritLow.Text + ")\r\n"; FormCustomConsole.WriteLine("SetCriticalLow(" + value + ", " + comboBoxDebugSetCritLow.Text + ")"); }