469,943 Members | 2,393 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,943 developers. It's quick & easy.

How to sum up all the integer values enteres in a list box?

i am doing a Point of Sales sytem.i am having trouble on how will i add all the integer values entered in a list box by clicking a command button with a corresponding integer value.
i want to compute the sum of those integers when i click the compute button. can someone give me an idea or a sample code?
Thanks in advance!
Jul 5 '12 #1
2 3423
Guido Geurs
767 Expert 512MB
Can you attach in Bytes an example of the data in the list and what the result must be after computation?
Not to much values please, just to have an idea what you want to process.
If the data is confidential, please replace it with fictive but representative values.
Jul 5 '12 #2
Killer42
8,435 Expert 8TB
Assuming we're talking about VB6 here, the simplest way to tally up the numbers in a list box would to use a loop something like...
Expand|Select|Wrap|Line Numbers
  1. For x = 0 to listbox.ListCount - 1
  2.   Tally = Tally + Val(listbox.List(x))
  3. Next
  4.  
Note the odd start/end values for the loop, thanks to the silly zero-based index that MS decided to use.
Jul 7 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

30 posts views Thread by priya | last post: by
6 posts views Thread by Tim Whelan via DotNetMonster.com | last post: by
2 posts views Thread by John Dalberg | last post: by
7 posts views Thread by zhouchengly | last post: by
4 posts views Thread by Gacha | last post: by
6 posts views Thread by Chuck Anderson | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.