Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 136,449 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,137 people online right now. Registration is fast and FREE... Join Now!




accumulator

 
Reply to this topicStart new topic

accumulator, need to accumulate weight and amount due

Backtoschool
30 Jul, 2008 - 03:48 PM
Post #1

New D.I.C Head
*

Joined: 30 Jul, 2008
Posts: 2

vb

Public Class mailorderForm
'Declare constants
Dim Handling0_TO_10 As Decimal
Dim Handling10_TO_100 As Decimal
Dim Handling100_Plus As Decimal
Dim ShippingChargeDecimal As Decimal
Dim Sales_TAXDecimal As Decimal

'Declare Module-Level variables
Dim amountDueDecimal As Decimal
Dim weightTotalDecimal As Decimal

Private Sub nextItemButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nextItemButton.Click
'Declare local variables
Dim amountDueDecimal As Decimal
Dim quantityInteger As Integer

Dim priceDecimal As Decimal

If nameTextBox.Text = "" Or addressTextBox.Text = "" Or cityTextBox.Text = "" Or stateTextBox.Text = "" Then
MessageBox.Show("The Name, Address, and State Fields cannot be blank.")
End If
If descriptionTextBox.Text = "" Or quantityTextBox.Text = "" Or weightTextBox.Text = "" And priceTextBox.Text = "" Then
MessageBox.Show("The Description, Quantity, Weight or Price Fields cannot be blank.")

End If

Try
'Convert
quantityInteger = Integer.Parse(quantityTextBox.Text)
weightTotalDecimal = Decimal.Parse(weightTotalTextBox.Text)

'Calculate
amountDueDecimal = quantityInteger * priceDecimal + weightTotalDecimal

'Accumulator
weightTotalDecimal =
amountDueDecimal =

Catch ex As Exception




I'm lost at Accumulators. Please help? Thank you =]

Mod Edit: Please use code tags when posting your code. Code tags are used like so => code.gif

Thanks,
PsychoCoder smile.gif
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Accumulator
30 Jul, 2008 - 04:03 PM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,993



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Moved to VB.NET smile.gif
User is offlineProfile CardPM
+Quote Post

Locke37
RE: Accumulator
30 Jul, 2008 - 05:56 PM
Post #3

I'm not a thief...I prefer the term TREASURE HUNTER!
Group Icon

Joined: 20 Mar, 2008
Posts: 1,005



Thanked: 39 times
Dream Kudos: 325
My Contributions
Accumulators are adding different values every time. For instance...

vb
Dim totalPrice As Double

'calculate a price for something

totalPrice = totalPrice + price

'accumulators just keep of track of how much of something
'has accumulated. Mainstream uses for these are things
'like total prices and such. The price of each purchase is
'added to the total every time. The total is an
'accumulator.


This post has been edited by Locke37: 30 Jul, 2008 - 05:56 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 02:50PM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month