Esempio n. 1
0
        private void FtoCbtn_Click(object sender, EventArgs e)
        {
            try {
                if (FtoC.Checked == true)
                {
                    var convert = new FtoC_Converter();
                    FahrenheitBox.Text = FahrenheitBox.Text + " Degrees Fahrenheit Is " + convert.FtoC_Con(FahrenheitBox.Text) + " Celsius";
                }

                else if (CtoF.Checked == true)
                {
                    var convert = new CtoF_Converter();
                    FahrenheitBox.Text = FahrenheitBox.Text + " Degrees Celsius Is " + convert.CtoF_Con(FahrenheitBox.Text) + " Fahrenheit";
                }

                else if (CtoK.Checked == true)
                {
                    var convert = new CtoK_Converter();
                    FahrenheitBox.Text = FahrenheitBox.Text + " Degrees Celsius Is " + convert.CtoK_Con(FahrenheitBox.Text) + " Kelvin";
                }

                else
                {
                    MessageBox.Show("Please select a conversion formula");
                }
            }

            catch (Exception)
            {
                MessageBox.Show("Please make sure only one formula box is selected before converting or that you have a valid entry in the input field");
            }
        }
Esempio n. 2
0
        private void FtoCbtn_Click(object sender, EventArgs e)
        {
            var convert = new FtoC_Converter();

            CelsiusBox.Text = convert.FtoC_Con(FahrenheitBox.Text);
        }