Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm using C# to make a Windows Form Application. My form has 4 labels, 4 text boxes, 2 buttons. I'm having trouble getting the area

I'm using C# to make a Windows Form Application. My form has 4 labels, 4 text boxes, 2 buttons. I'm having trouble getting the area and perimeter. When I enter length and width and push calculate button, nothing shows in textbox for area and perimeter. Can you please explain what I'm doing wrong. This is my event handler code for my calculate button:

private void btnCalculate_Click(object sender, EventArgs e) {

double length, width,area,perimeter;

length = Convert.ToDouble(txtLength.Text);

width = Convert.ToDouble(txtWidth.Text);

area = length * width;

perimeter = (2 * length + 2 * width);

String txtArea = Convert.ToString(area);

btnCalculate.Text = Convert.ToString(perimeter);

Console.WriteLine(txtArea);

}

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

Step: 3

blur-text-image

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

Nested Relations And Complex Objects In Databases Lncs 361

Authors: Serge Abiteboul ,Patrick C. Fischer ,Hans-Jorg Schek

1st Edition

3540511717, 978-3540511717

More Books

Students also viewed these Databases questions