예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            ;
            try
            {
                double W = double.Parse(txtweight.Text) * 10;
                double H = double.Parse(txtheight.Text) * 6.25;
                double A = double.Parse(txtAge.Text) * 5;
                double BMR;


                if (checkmale.CheckState == CheckState.Checked)
                {
                    BMR = W + H - A + 5;
                }
                else
                {
                    BMR = W + H - A - 161;
                }

                lblresult.Text = "BMR = '" + BMR.ToString() + "' Calories/day";
            }
            catch
            {
                if (txtAge.Text == "")
                {
                    lblA.Text = "**";
                }
                if (txtheight.Text == "")
                {
                    lblH.Text = "**";
                }
                if (txtweight.Text == "")
                {
                    lblW.Text = "**";
                }
                if (checkmale.CheckState == CheckState.Unchecked && checkfemale.CheckState == CheckState.Unchecked)
                {
                    lblG.Text = "**";
                }
                MessageBox.Show("Registration failed, please check the information again ");
            }
        }
예제 #2
0
        private void btn_bmr_Click(object sender, EventArgs e)
        {
            BMR bmr = new BMR();

            bmr.Show();
        }