Question
Visual C# public partial class frmCalories : Form { //Field variables (class-level) double dblFatGrams; double dblCarbGrams; public frmCalories() { InitializeComponent(); } private bool Validate_Input() {
Visual C#
public partial class frmCalories : Form { //Field variables (class-level) double dblFatGrams; double dblCarbGrams;
public frmCalories() { InitializeComponent(); } private bool Validate_Input() { bool blnValidNumber;
//Validate fat grams input //Call TryParse method of double to convert txtFatGrams.Text string to dblFatGrams
//Validate carb grams input //Call TryParse method of double to convert txtCarbGrams.Text string to dblCarbGrams
//Data is OK return true;
}
private void btnExit_Click(object sender, EventArgs e) { this.Close(); }
private void btnCalories_Click(object sender, EventArgs e) { } } }
Lab Problem: 1. Yo u will copy/open the Calories project from the K: drive to your H: drive or flash drive. Read problem #4 found on page 391 to complete this application. A method for validating the two inputs has been started for you. Instead of using the MessageBox class to display error messages for user input, you will use the ErrorProvider Component located in the toolbox. An example of using this control can be found on pages 729-731 of textbook (Appendix B). What needs to be displayed in the label named IblCalories? The following 2 line.. Calories from fat: 99 Calories from carbs: 99 Please note: The icons that appear for the ErrorProvider control when an error occurs will have to be cleared somewhere in your code by calling the Clear) method. Assessment Grader: --(2 pt) Validate method works correctly with the ErrorProvider component. (2 pt) Method for calculating calories from fat. _ (2 pt) Method for calculating calories from carbs -_ (2 pt) Output is displayed correctly for calories from fat and carbs. --(2 pt) Application logic/test resultsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started