private void btnConvert_Click(object sender, EventArgs e) { double valueFromTextBox; try { if (String.IsNullOrEmpty(textBoxValue.Text)) { throw new Exception("Field cannot be empty"); } labelError.Text = ""; Double.TryParse(textBoxValue.Text, out valueFromTextBox); _temperatureConverter.SetTemperature(Double.Parse(textBoxValue.Text)); if (comboBoxConvertFrom.SelectedItem == null || comboBoxConvertTo.SelectedItem == null) { throw new ArgumentNullException(null, "Pick a unit!"); } labelResult.Text = Math.Round(_temperatureConverter.HandleConverter( comboBoxConvertFrom.SelectedItem.ToString(), comboBoxConvertTo.SelectedItem.ToString()), 2).ToString(); } catch (ArgumentNullException ex) { labelError.Text = ex.Message; } catch (Exception ex) { labelError.Text = ex.Message; } }