Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions