d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Clearly Visual Basic 2010 > Need Help Coding A Discount Calculator
Add Reply New Topic New Poll
Member
Posts: 1
Joined: Jun 22 2012
Gold: 0.00
Jun 22 2012 03:03pm
I need help with this problem. I'm suppose to use the Display button's click event procedure to display amounts in the txtDiscounts control. Then display the discount amounts using the sales amount of $10 through $15 in increments of $1. Then the rates from 5% through 10% in increments of 1%. Then display the discount amounts by rate within the sales.

Public Class frmMain

Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub

Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
' display the discount amount using sales amounts

Dim decDiscount As Decimal


' clear the discount box
txtDiscounts.Text = String.Empty

' calculate the discount from the sales and the rate


For decSalesAmt As Integer = 10 To 15
txtDiscounts.Text = txtDiscounts.Text
For decRate As Decimal = 5% To 10% Step 1%
decSalesAmt =
(decDiscount = decSalesAmt * decRate)
txtDiscounts.Text = txtDiscounts.Text &
decRate.ToString("PO") & "to" &
decDiscount.ToString("C2") & ControlChars.NewLine
Next decRate
txtDiscounts.Text = txtDiscounts.Text & ControlChars.NewLine
Next decSalesAmt

End Sub



























Private Sub txtDiscounts_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDiscounts.Click

End Sub
End Class
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jun 22 2012 05:18pm
can you explain what your problem is? i dont feel like compiling, running, and debugging that.
Member
Posts: 7,635
Joined: Jul 3 2007
Gold: 243.00
Jun 26 2012 09:10am
Quote (carteblanche @ 22 Jun 2012 19:18)
can you explain what your problem is? i dont feel like compiling, running, and debugging that.


this

And what this line is supposed to do ?
txtDiscounts.Text = txtDiscounts.Text
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Jun 26 2012 11:30am
Quote (WhDemon @ Jun 26 2012 11:10am)
this

And what this line is supposed to do ?
txtDiscounts.Text = txtDiscounts.Text


well you see its supposed to assign the txtdiscounts text to itself~ which has 0 use
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll