# Sod Project

141 Reputation points
2022-05-09T00:48:01.897+00:00

Basically The problem is that the answer I'm getting is not the same as the example of the answer I provided or similar. I just need the code so that when I enter any length, any width, any price of sod I should be getting a total price not a blank in the total price and \$0.00 in the sod price text box? I just need the correct code to be able to run this application the way it wants me to. specifically for the part in question 4 that says A Calculate button that when clicked determines the total cost of laying sod based upon the three values entered by the user. The three values are Length, Width, Sod Price

This is the code I have at the moment.

``````Public Class frmMain

'creating object of rectangle
Dim rectangle As New Rectangle()

Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
Dim Length As Integer
Dim Width As Integer

Dim rect As New Rectangle(Length, Width)

Dim area As Integer = rect.GetArea()

Dim Price As Double
'Since the area is in sq feet and price is given per sq yards
'We'll convert sq feet to sq yard, by dividing by 9
Dim areaInSqYd As Double = area / 9

Dim totalPrice As Double = areaInSqYd * Price

'Call the sub routine updatedisplayTotalPrice to update the text.
updatedisplayTotalPrice(totalPrice)
'Displays the total price in proper currency format
txtPrice.Text = String.Format("{0:C2}", totalPrice)

End Sub
Private Sub updatedisplayTotalPrice(ByVal totalPrice As Double)

End Sub

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub

End Class

``````

Thanks

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,663 questions

1. 29,106 Reputation points Microsoft Vendor
2022-05-09T01:32:24.047+00:00

Hi @Burke, Brendan J ,
You forgot to get length, width, price from TextBoxs.

``````         Dim Length As Integer = TextBoxLength.Text
Dim Width As Integer = TextBoxWidth.Text
Dim Price As Double = TextBoxPrice.Text
``````

Best Regards.
Jiachen Li

----------

1. 5,846 Reputation points
2022-05-09T01:02:39.777+00:00

It looks like this function should display the price

`````` Private Sub updatedisplayTotalPrice(ByVal totalPrice As Double)

End Sub
``````

but there is no code in it. You would need to set the control which displays the total price text property to totalPrice

`````` myControl.Text = totalPrice.ToString("c")
``````