473,403 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Help with calculation


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

Mar 2 '06 #1
3 877
Hi BasicNet,

What is your question?

--
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
Mar 2 '06 #2
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" <ba*************@mail.codecomments.com> wrote in message
news:ba*************@mail.codecomments.com...

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

Mar 2 '06 #3
> 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

Mar 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Umesh | last post by:
Hi I am developing a windows application. This contains a Data grid which will populate data from a data table in a Dataset. The application will do some calculation and store the result in the...
3
by: Sean McCourt | last post by:
Hi I am doing a JavaScript course and learning from the recommed book (JavaScript 3rd Edition by Don Gosslin) Below is one of the exercises from the book. I get this error message when I try to...
0
by: leavandor | last post by:
I am trying to design a query that works with a relationship between a Table and a Query. I am comparing a value in the table with a computed value inside the query. The reason for this is that...
13
by: Fao | last post by:
Hello, I am having some problems with inheritance. The compiler does not not return any error messages, but when I execute the program, it only allows me to enter the number, but nothing else...
1
by: jlf | last post by:
Need serious help with a calculation. The fields are based on a query that has linked many different tables. The calculation I currently have is: =sum()/((+)*(Piecesnum])) It is giving a...
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
10
by: 60325 | last post by:
This is the page where I collect the data in drop-down boxes with values of 1-10 and send it to a submitted page to do calculations. Example: Employee1 TeamScore(1-10) Employee2 ...
47
by: Jo | last post by:
Hi there, I'm Jo and it's the first time I've posted here. I'm in process of creating a database at work and have come a little unstuck.....I'm a bit of a novice and wondered if anyone could...
12
by: adamurbas | last post by:
ya so im pretty much a newb to this whole python thing... its pretty cool but i just started today and im already having trouble. i started to use a tutorial that i found somewhere and i followed...
3
by: Dew | last post by:
Hello, iam new to programming, and ive been given a task in my Uni to complete certain exercises but i found it very difficulty to solve them. I was wandering if there is someone who can help me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.