Help with calculation

Discussion in 'ASP .Net' started by basicnet, Mar 2, 2006.

  1. basicnet

    basicnet Guest

    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

    Dim intRadius As Single
    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 Su


    -
    basicne
    -----------------------------------------------------------------------
    Posted via http://www.codecomments.co
    -----------------------------------------------------------------------
     
    basicnet, Mar 2, 2006
    #1
    1. Advertising

  2. basicnet

    Ward Bekker Guest

    Ward Bekker, Mar 2, 2006
    #2
    1. Advertising

  3. Have you considered that the circumference of a circle is not only 2* PI* r,
    but also PI*d?

    Think about it.

    In addition, why not use Math.PI for a more accurate answer?

    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" <> wrote in message
    news:...
    >
    > 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
    >
    > Dim intRadius As Single
    > 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
    > ------------------------------------------------------------------------
    > Posted via http://www.codecomments.com
    > ------------------------------------------------------------------------
    >
     
    Kevin Spencer, Mar 2, 2006
    #3
  4. basicnet

    Hans Kesting Guest

    Re: =?UTF-8?B?SGVscCB3aXRoIGNhbGN1bGF0aW9u?=

    > 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
    >
    > Dim intRadius As Single
    > 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
     
    Hans Kesting, Mar 2, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2ltbw==?=

    Need help With Discount Calculation!!

    =?Utf-8?B?U2ltbw==?=, Nov 4, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    4,465
    =?Utf-8?B?U2ltbw==?=
    Nov 5, 2005
  2. ron
    Replies:
    1
    Views:
    907
    Stewart Gordon
    Jul 2, 2003
  3. Ding Lei
    Replies:
    9
    Views:
    8,317
    Roedy Green
    Jun 25, 2004
  4. Neredbojias
    Replies:
    3
    Views:
    482
    Neredbojias
    Oct 4, 2005
  5. Help on Astrolgical Calculation

    , Sep 19, 2005, in forum: C Programming
    Replies:
    6
    Views:
    301
    SM Ryan
    Sep 19, 2005
Loading...

Share This Page