Ejemplo n.º 1
0
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            double Height, Weight;

            if (checkBox1.Checked)
            {
                if (double.TryParse(txtPatHeight.Text, out Height) == true && double.TryParse(txtPatWeight.Text, out Weight) == true)
                {
                    txtpatBMI.Text = string.Format("{0:n2}", selectClass.calBMI(Convert.ToDouble(txtPatHeight.Text), Convert.ToDouble(txtPatWeight.Text)).ToString());
                }
                else
                {
                    checkBox1.CheckState = 0;
                    MessageBox.Show("Either Height or Weight value is not numeric" + Environment.NewLine + "Please check the values", "Error - Onana HMS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else if (!checkBox1.Checked)
            {
                txtpatBMI.Text = "";
            }
        }