473,568 Members | 2,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Percentages

DAL
I have two textboxes. One is to enter the percentage rate, and the other
text box is to enter the price of the item. What is the formula to get the
correct answer after the percentage has been subtracted from the original
price.

Example: 10% of $1 = .90

Thank you in advance, DAL.
Feb 14 '06 #1
3 1578
Try this.

Dim prcnt as Integer = cint(txtPercent )
Dim price as Integer = cint(txtPrice)

Dim Xnum as Integer = (100 - prcnt )/100

txtFinalPrice.T ext = price * Xnum

Pretty much what your doing is subtracting the entered percentage from
100 and then dividing that from 100. Then multiplying that by the
price.

Example:

100% - 10% = 90%
90/100 = .9

..9 X $1 = .90

Hope this helps,
Jeremy Reid
http://blackstaronline.net/hgtit

Feb 14 '06 #2
Don

Sorry to butt in but . . . , you can't use integers to calculate
percentages unless you significantly modify the approach.

Don

On 14 Feb 2006 14:53:52 -0800, jr***@blackstar online.net wrote:
Try this.

Dim prcnt as Integer = cint(txtPercent )
Dim price as Integer = cint(txtPrice)

Dim Xnum as Integer = (100 - prcnt )/100

txtFinalPrice. Text = price * Xnum

Pretty much what your doing is subtracting the entered percentage from
100 and then dividing that from 100. Then multiplying that by the
price.

Example:

100% - 10% = 90%
90/100 = .9

.9 X $1 = .90

Hope this helps,
Jeremy Reid
http://blackstaronline.net/hgtit

Feb 15 '06 #3
Whoops, my bad, Thanks for catching that. Don is absolutely correct.
Integer data type is NOT what you would want to use to calculate that
equation.

Sorry for leading you down the wrong path....my bad.
Jeremy Reid
http://blackstaronline.net/hgtit

Feb 15 '06 #4

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

Similar topics

0
1168
by: Avinash Dhoot | last post by:
Hi, I have a 5 row table with the following values. key value 1 5 2 10 3 15 4 15 5 5
0
3059
by: michael | last post by:
I've got a 3-column layout using percentages to define width of each div-column. #left-col { width: 20%; background-color: green; float:left; } #center-col { width: 60%; background-color: blue; float:left; } #right-col { width: 20%; background-color: green; float:left; } Problem I find is if the combined content of all 3 columns happens...
1
2504
by: Megan | last post by:
quick summary: i'm having problems trying to group fields in a report in order to calculate percentages. to calculate percentages, i'm comparing the results from my grouped fields to the totals. first, let me say that this is a really long post. i wasn't sure how much information/ background to provide, so i thought more was better than...
2
4126
by: Dot net work | last post by:
Hello. Is it possible to build up a dynamic server side table, and specify the column widths as percentages? I've tried this: Set the table width to 100%, then: FirstColumn.Width = New Unit(50, UnitType.Percentage) SecondColumn.Width = New Unit(30, UnitType.Percentage) ThirdColumn.Width = New Unit(20, UnitType.Percentage)
26
2214
by: Mike Barnard | last post by:
Hi all. I am playing with html and css. I don't (yet) have a working site, I'm just trying to build a working, basic template I can use for a couple of ideas I have. I recall reading a discussion in a newsgroup in the past that came to the conclusion that the best way to use font sizes with css was to use percentages. Is that still the...
5
1880
by: Chris H | last post by:
I am wanting to write a function for a poker league manager that will detrmine players finishing points in a tournament depending on the amount of players that played... In other words when the tournament director enters the tournament results into the database, he will enter the number of players that played and then upon submissin this...
1
1686
by: Bob Alston | last post by:
I need to produce a report like this Color: # % ------ --- --- White 10 20 Black 25 50 other 15 30 ---- ---- Total 50 100
9
27809
by: AZKing | last post by:
Hi all, I would like to know how do you go about calculating percentages in Access. For example, in a form I have 3 combo boxes with drop down menus where a user can select "Yes" or "No" and a text box where I will calculate a percentage. What I am looking for is something like this: If combo1 = "yes" then percentagebox = 1 / 3 * 100...
3
2065
by: martin DH | last post by:
Access 2003 I have a table (TASKS) filled with data from an external source. The table lists several tasks for employees to complete and has a text field (STATUS) that identifies where in the completion process the task is by a single alpha character (e.g. C=Complete, N=Not Started, A=Actively Working, W=Waiting, and X=Not Applicable). I have...
0
1348
by: marcopolo8 | last post by:
Wierd thing is happening during my xHTML development. When I set the width attribute of a text field in a form and use percentages, if the text field's value is extremely long, IE6 automatically widens the width of my text field. For example -- input type="text" width="90%" value="Some extremely long value" -- IE6 will allow this text field to...
0
7604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8117
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7660
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6275
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
932
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.