Users enter (in text boxes) the grams of fat, the grams of carbohydrates, and the grams of protein.
Each gram of fat is nine calories; a gram of protein or carbohydrate is four calories.
How can I write this ?
Thanks
Printable View
Users enter (in text boxes) the grams of fat, the grams of carbohydrates, and the grams of protein.
Each gram of fat is nine calories; a gram of protein or carbohydrate is four calories.
How can I write this ?
Thanks
intCalories = txtFat.Text * 9 + (txtCarbohydrates.Text + txtProtein.Text) * 4
Make sure that the user entered valid values into the textbox. SetWindowLong from the API i.c.w. "ES_NUMBER" is a possible solution for.