Question: 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

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!