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) { } } }

Visual C# public partial class frmCalories : Form { //Field variables (class-level)double dblFatGrams; double dblCarbGrams; public frmCalories() { InitializeComponent(); } private bool Validate_Input()

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 results

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!