Mathematical Operations and Allocation

Joined
Oct 28, 2006
Messages
19
Programming Experience
Beginner
As i can now complete most of my program i just have a few issues i dont know how to do. One thing i need to do is display the total amount donated. Each record specifies the amount that person is donating so what is the best way to perform this calculation without using a very very large number of variables. The other issue i have is i need to create table allocation so each person is allocated a table, maximum number of people to a table is 10 and there are 50 tables. It must also add the number of guests. If someone could tell me how to do the maths bit and give me some pointers on the allocation i might get this program to run.
 
for the donations part, simply use a Decimal variable (probably named 'decDonations') then as you loop through all the guests simply increment the donations var so you'll only be using 1 var instead of lots

also a shortcut you can use it the '+=' math operator
decDonations += AmountThisGuestDonated
 
If you are saying (without actually saying) that you have data in a DataTable then you can use the Compute method:
VB.NET:
Dim totalDonations As Decimal = DirectCast(myDataTable.Compute("SUM(DonationAmount)"), Decimal)
 
I dont have it in a datatable its in an arraylist which is the datasource for a dataview.
Then you'd use JB's suggestion in a For Each loop.
jmcilhinney it seems u know a lot of things.. for how long you`ve been programming ?
1998. Since 2003 with .NET.
 
jmcilhinney it seems u know a lot of things.. for how long you`ve been programming ?

he's also from australia too, which means he doesnt have the USA mentallity and is prone to be able to learn things better then us US folks :p
 
Offtopic again : jmcilhinney do you think that i may learn programming ( in vb.net language) in one year ? if i learn 5 or 6 hours a day ?
Let's keep questions unrelated to the thread topic to their own thread or PMs. For this time only: it really depends on what you consider to have learned something. There are books available name "Teach Yourself VB.NET in 24 Hours" and "Teach Yourself VB.NET in 21 Days". Now, noone is going to string those hours or days back to back and absorb everything, but if you were to work your way through either of those books, or a similar course, then you'd have a fairly handly grasp of the basics. There'd still be plenty to learn though. There's an awful lot that I don't know. That's one reason that this field is so exciting.
 
he's also from australia too, which means he doesnt have the USA mentallity and is prone to be able to learn things better then us US folks :p

JuggaloBrotha it seems you don`t how to read. :p I`m from Romania. And by the way the USA mentallity it`s down. Do you know how many crackers, hackers are born in Romania/a day ?:) United States are hiring a lot of ROMANIAN people to work for them in this domain. We are pretty smart. A month ago a romanian made a FORUM with FBI`s top secret files ( means that your country lost a lot of milions of $ ).
 
Back
Top