473,841 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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 3574
Guido Geurs
767 Recognized Expert Contributor
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
8,435 Recognized Expert Expert
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
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

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

Similar topics

by: priya | last post by:
Hi How to concatenate two integer Values. Example Program : #include "Port.h" #include "BinaryConversion.h" # include "iostream.h"
by: Tim Whelan via DotNetMonster.com | last post by:
Hi I am developing an asp.net web application using c# and having trouble trying to display integer values, that I have taken from the database, correctly on my webform textboxes. The values are consistently displayed with four 0?s after the decimal point and I am just wondering if anyone knows how to prevent this from happening. Thanks in advance. Tadhg88 -- Message posted via http://www.dotnetmonster.com
by: John Dalberg | last post by:
I am adding integer values from a datarow collection to a List<int> using the Add method. The values are read in the correct order from the collection but once the List is populated, the values in the List are sorted in ascending order. Why? This is undesirable. John Dalberg
by: TheRomance | last post by:
i have a problem about insert integer to link list. sorry it's too long but i try many times, many ways , it's still have an error function is fix . can't change anything about function. i can only make a code that work with function. Number.cpp #include "Number.h"
by: zhouchengly | last post by:
when I use the following code to get integer values from file: void getIntegers() { vector<ItemType items; ifstream ifs("test.dat"); //考虑为items一次分配空间。 ItemType item ; while( !ifs.eof() ) { ifs>>item;
by: Syd_Man | last post by:
I have a Gridview that is passing value to a detailsview controls using DefaultValue="EmployeeID = {0}" syntax however if I use the same syntax for the Integer it raises some Conversion error. What is the syntax to use the same method to pass Integer values to detailsview? SelectParameters>
by: Gacha | last post by:
I use pyExcelerator to import some data from xml file. One column contains integer values like: 4750456000708 4750456000715 4750456000333 .... But when I do import the pyExcelerator converts them to something like this: 4.7504560002e+12 4.7504560007e+12
by: haelly | last post by:
write a program that prompts the user to enter three different positive integer values.If the values are not different, the program prints a message"equal value" and terminates(hint:use the return statement).If eithere of the value is negative, the program prints "negative input" and terminates.Otherwise it prints the value the user entered. After that,the program compares he first integer and the second integer and prints either, "the first...
by: Chuck Anderson | last post by:
Granted, this is mostly a mysql question, but I think understanding the Php makes it easy to understand why my question is necessary. I'm writing a Php loop to create INSERT and UPDATE queries from $_POST data. All posted variables have to use the same name as the respective column in the database for this to work. I also have know what the primary - auto increment column is so I do not try to insert or update it. ...
by: mohammed alhadi | last post by:
Hi All, I don't want to use the struct structure to access or represent the elements, I just want to save integer values to a binary file (now I have the data stored on a text file and the first line in it represent the dimensions of the matrix) and then access them and store them in a 1D array. for which the integer values are representable in reality by a 2D matrix but i will store them on a binary file, and I am going to copy them from...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we抣l explore What is ONU, What Is Router, ONU & Router抯 main usage, and What is the difference between ONU and Router. Let抯 take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project梡lanning, coding, testing, and deployment梬ithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.