Velocity Reviews > Help with calculation

Help with calculation

basicnet
Guest
Posts: n/a

 03-02-2006

Please don't flame me for asking such a dumb question, but this progra
is supposed to calculate the circumference and the total price of th
railing material....

this is what I have....

txtDiameter is the textbox where they eneter the diameter of th
circle

txtMaterialPrice is where they enter the price of the railing materia
per foot

lblCircumference is the display for for the calculated diameter of th
circle

lblPriceDisplay is the total price of material

------------------------------------------------------------

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal
As System.EventArgs) Handles btnCalculate.Click

Dim decCircumference As Decimal
Dim decPriceDisplay As Decimal
Dim decDiameter As Decimal
Dim decMaterialPrice As Decimal

lblCircumference.Text = 2 * 3.14 * intRadius

decPriceDisplay = decMaterialPrice * decCircumference

decDiameter = Convert.ToDecimal(Me.txtDiameter.Text)
decMaterialPrice = Convert.ToDecimal(Me.txtMaterialPrice.Text)

Me.lblCircumference.Text = Convert.ToString(decCircumference)
Me.lblPriceDisplay.Text = Convert.ToString(decPriceDisplay)

Me.lblCircumference.Focus()
Me.lblPriceDisplay.Focus()

End Su

-
basicne
-----------------------------------------------------------------------
-----------------------------------------------------------------------

Ward Bekker
Guest
Posts: n/a

 03-02-2006
Hi BasicNet,

--
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com

"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx

Kevin Spencer
Guest
Posts: n/a

 03-02-2006
Have you considered that the circumference of a circle is not only 2* PI* r,
but also PI*d?

However, I'm sure that's not what you're asking. Problem is, you didn't.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A brute awe as you,
a Metallic hag entity, eat us.

"basicnet" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Please don't flame me for asking such a dumb question, but this program
> is supposed to calculate the circumference and the total price of the
> railing material....
>
> this is what I have....
>
> txtDiameter is the textbox where they eneter the diameter of the
> circle
>
> txtMaterialPrice is where they enter the price of the railing material
> per foot
>
> lblCircumference is the display for for the calculated diameter of the
> circle
>
> lblPriceDisplay is the total price of material
>
> ------------------------------------------------------------
>
> Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles btnCalculate.Click
>
> Dim decCircumference As Decimal
> Dim decPriceDisplay As Decimal
> Dim decDiameter As Decimal
> Dim decMaterialPrice As Decimal
>
> intRadius = Val(txtDiameter.Text) / 2
> lblCircumference.Text = 2 * 3.14 * intRadius
>
> decPriceDisplay = decMaterialPrice * decCircumference
>
> decDiameter = Convert.ToDecimal(Me.txtDiameter.Text)
> decMaterialPrice = Convert.ToDecimal(Me.txtMaterialPrice.Text)
>
> Me.lblCircumference.Text = Convert.ToString(decCircumference)
> Me.lblPriceDisplay.Text = Convert.ToString(decPriceDisplay)
>
> Me.lblCircumference.Focus()
> Me.lblPriceDisplay.Focus()
>
> End Sub
>
>
>
> --
> basicnet
> ------------------------------------------------------------------------
> ------------------------------------------------------------------------
>

Hans Kesting
Guest
Posts: n/a

 03-02-2006
> Please don't flame me for asking such a dumb question, but this program
> is supposed to calculate the circumference and the total price of the
> railing material....
>
> this is what I have....
>
> txtDiameter is the textbox where they eneter the diameter of the
> circle
>
> txtMaterialPrice is where they enter the price of the railing material
> per foot
>
> lblCircumference is the display for for the calculated diameter of the
> circle
>
> lblPriceDisplay is the total price of material
>
> ------------------------------------------------------------
>
> Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles btnCalculate.Click
>
> Dim decCircumference As Decimal
> Dim decPriceDisplay As Decimal
> Dim decDiameter As Decimal
> Dim decMaterialPrice As Decimal
>
> intRadius = Val(txtDiameter.Text) / 2
> lblCircumference.Text = 2 * 3.14 * intRadius
>

Here you set lblCircumference.Text

> decPriceDisplay = decMaterialPrice * decCircumference

and here you use the (unassigned) decCircumference

>
> decDiameter = Convert.ToDecimal(Me.txtDiameter.Text)
> decMaterialPrice = Convert.ToDecimal(Me.txtMaterialPrice.Text)
>
> Me.lblCircumference.Text = Convert.ToString(decCircumference)

here also

> Me.lblPriceDisplay.Text = Convert.ToString(decPriceDisplay)
>
> Me.lblCircumference.Focus()
> Me.lblPriceDisplay.Focus()
>
> End Sub