Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1- Using the if(datatype.TryParse ( ) methods. To validate user input. 2- Display an error message for celsius TextBox. I did use if(datatype.TryParse ( )

1- Using the if(datatype.TryParse ( ) methods. To validate user input.

2- Display an error message for celsius TextBox.

I did use "if(datatype.TryParse ( ) methods. To validate user input." but I'm not sure it works fine, but whenever I add "Display an error message for celsius TextBox."

to prevent user of entering "letters" so that the program doesn't crash it gives me errors.

image text in transcribed

image text in transcribedimage text in transcribed

image text in transcribed

- Temperature Conversion x Enter Temperature Value: Converted Temperature: Convert to Celsius Convert to Fahrenheit Clear Exit ITETET TILE private void celsiusButton_Click(object sender, EventArgs e) { // Declare Variables so the program identify what you are trying to do. double f = Convert.ToDouble(valuetextBox.Text); const double x = 5.00 / 9.00; double c; 20 21 22 23 24 25 26 27 28 29 20 30 31 20 32 2 33 24 2 if (double. TryParse(valuetextBox.Text, out c)) // formula to calculate in celsius. C = ((f - 32) * x); // Disply the value in textb. displayLabel.Text = c.ToString("n2"); { 34 35 else { 36 37 38 39 40 41 42 43 // Display an error message for celsius TextBox. MessageBox.Show("Invalid input for celsius."); { } 44 45 } 46 47 48 49 - private void fahrenheitButton Slick(object sender, EventArgs e) { { //// Declare Variables so the program identify what you are trying to do. double & = Convert.ToDouble(valuetextBox.Text); cons+ daunlov - AA 15 AA. 50 51 100 % 20 1 // Display an error message for celsius TextBox. MessageBox.Show("Invalid input for celsius."); { } } } 38 39 40 4 41 42 43 44 45 46 47 48 49 ra 50 51 private void fahrenheitButton Click(object sender, EventArgs e) { { //// Declare Variables so the program identify what you are trying to do. double c = Convert.ToDouble(valuetextBox.Text); const double x = 9.00 / 5.00; double f; 52 53 54 55 56 57 ra 58 59 60 61 62 63 GA 64 65 66 67 68 if (double. TryParse(valuetextBox.Text, out f)) W formula to calculate in celsius. f = (( * x) + 32); //Disply the value in textb. displayLabel.Text = f.ToString("n2"); } else { // Display an error message for fahrenhe TextBox. MessageBox.Show("Invalid input for fahrenhe."); 11 } } 100 % 20 > 50 51 52 1 reference private void clearButton_Click(object sender, EventArgs e) { // Clear all values. displayLabel.Text = ""; valuetextBox.Text = ""; 54 55 56 57 1 reference private void exitButton_Click(object sender, EventArgs e) { // Exit the program. this.Close(); 58 59 60 61 62 63 64 65 } } 100% No issues found

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

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions

Question

Describe the factors influencing of performance appraisal.

Answered: 1 week ago

Question

2. Employees and managers participate in development of the system.

Answered: 1 week ago