Microsoft
Software
Hardware
Network
Question : subtract 10% from textbox
hi,
I have a button which when pressed changes the background colour, I also want it to deduct 10% from the total of a textbox, then when clicked, change the colour back and reapply the 10%. .... The code so far is:
If percent10.BackColor = Color.LightGray Then
percent10.BackColor = Color.Red
discountlabel.Text = "10% Discount Applied"
lbltotal.Text = Format(Val(lbltotal.Text) / 10, "0.00")
Else
percent10.BackColor = Color.LightGray
discountlabel.Text = ""
lbltotal.Text = Format(Val(lbltotal.Text) * 0.1, "0.00")
End If
This gives some strange results though and I can't work out where I am going wrong. Can anyone help?
Thanks
Answer : subtract 10% from textbox
a 10% discount is NOT what you get when you divide by 10. Rather a 10% discount is the original value MINUS10%of that original value
Discount = 0.1* OriginalValue
DiscountedVal
ue = OriginalValue - Discount
then, to get the orginal value back again, you would add the Discount to the DiscountedValue:
OriginalVa
lue = DiscountedValue + Discount
Random Solutions
Ho Do you Create a timeline Planner/diary in vb.net
When the same MS Word 2007 Application runs on different machines, Forms on one machine may have darker shades of gray than on another. Why?
Capturing handwriting
Webassist Dynamic Drop Down
How to deny write to the desktop for users?
Inline attachments with Lotus Notes
SQL Server 2008 Licensing
ASP.Net C#, MS SQL
How to remove automatic login from Outlook 2010
Quality Center