How to Calculate SubTotal ?

goni07

New member
Joined
Mar 13, 2009
Messages
1
Programming Experience
Beginner
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub
 

Attachments

  • sample.JPG
    sample.JPG
    31.1 KB · Views: 38
Last edited:
I think he's after more than just Price X Quantity

goni07

Your datatable should have:
UnitPrice
Quantity

as columns

Then it should have TWO MORE columns:

LineTotal
whose EXPRESSION property is set to "([unitPrice] * [Quantity]) - ([unitPrice] * [Quantity] * [Discount])"
if discount is a percentage.. if it's not, i leave you to work out how to apply it :)

OrderTotal
whose EXPRESSION property is set to "SUM([LineTotal])"



Now every row in the table will show the SAME value in the OrderTotal column

Bind that column to your total text box. No matter what row is in the Current position of the binding source, the total shows the same value
Changing any UnitPrice or Quantity updates all columns automatically

It's cool
 

Latest posts

Back
Top