public void BMIBox_TextChanged(object sender, EventArgs e) { string con = MyMethodsLib.GetConnectionString(); string height = MyMethodsLib.GetHeightFromDbs(Username, con).ToString(); this.BMIBox.Text = MyMethodsLib.CalculateBMI(this.weightBox.Text.ToString(), height); this.WeightResultBox.Text = "Press"; double.TryParse(this.BMIBox.Text, out double valToCompare); if (valToCompare < 24.9) { dietModeBox.Text = "Not set"; string dietModeBoxToBeSet = MyMethodsLib.SetDietModeDbs(Username, dietModeBox.Text, con); dietModeBox.Text = dietModeBoxToBeSet; intakeBox.Text = "0"; } }