help

  • Thread starter Thread starter alawson23
  • Start date Start date
A

alawson23

hi. im doing a VB project for school and i need some
help. i have visual basic 6.0. here is my code for my
menu calculate button, where the problem is happening.

Private Sub MNUCalculate_Click()
Dim original As Currency
Dim salestax As Currency
Dim salescharged As Currency
Dim totalprice As Currency
Dim salescharged2 As Currency
original = InputBox("Enter the Original Price of
Product", "Enter the Original Price of Product")

salestax = InputBox("Enter the Sales tax that will be
Applied to Product", "Enter the Sales tax that will be
Applied to Product")

LBLOrginalAmount = Format(original, "Currency")
LBLSalesTax = salestax & "%"

salescharged = original * salestax
'salescharged2 = Format(salescharged, "percent")

LBLSalesTaxCharged = Format(salescharged, "currency")
totalprice = salescharged + original
LBLTotalPrice = Format(totalprice, "currency")
MNUClear.Enabled = True





as you can see. its a simple project for school. but im
trying to calculate the price of an item when i put the
original price in and the tax rate. everything is good
slept for when im trying to calculate how much tax im
charged. i put in 2 dollars for the original price and
8.5 for tax rate. it calculates out to $17 for just tax
and i can figure out thats not right. It will work right
if i put in .085 for sales tax, but im wanting to be able
to put in 8.5 and not .085. how do i change it for it
calulates it right and displays it to LBLSalesTaxCharged
right. it should say .17 cents, but i cant figure out how
to change it in the code for it to display and work right.

Thanks for the help.
 
Hi,

Change the salestax variable by multiplying it after it's entered thus:

dim revisedsalestax as currency
revisedsalestax = salestax * .01
salescharged = original * revixedsalestax

HTH,

Bernie Yaeger
 
Hi Bernie,

One of the codes in this newsgroup.

Not help with homework, because that is no help.

:-)

Cor
 
Back
Top