473,386 Members | 1,835 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to make totals of the items in a combo box

I have got like 10 or so items (numbers) and i would like to have they totals. i.e item 1 + item 2 + item 3 + , etc.... As may items as found in the combo box
May 2 '14 #1
1 1114
Luk3r
300 256MB
Expand|Select|Wrap|Line Numbers
  1.         Dim results As Integer
  2.  
  3.         For Each itm In ComboBox1.Items
  4.             If Not itm = "" Then
  5.                 results = results + itm
  6.             End If
  7.         Next
The idea behind the code is that you specify an integer (a number) and continue adding to it. The For loop loops through each item in your combobox and if the item is not blank, then it adds it to the integer you specified and eventually creating a sum of all items.

You can display the results simply by adding something like the following to the end of the code:
Expand|Select|Wrap|Line Numbers
  1.         MsgBox(results)
May 2 '14 #2

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

Similar topics

13
by: geotso | last post by:
What I'm trying to do is something like this: 1. . . . . 2. . . . . 3a . . . . 3b . . . . 3c. . . . . 4. . . . . etc. Can you help me please?
3
by: Heather | last post by:
I notice the Tag property for menu items. Is there a way to assign say a 1 to the Tag property of certain menu items and then make those menu items not visible programatically? Thanks! Heather
1
by: Brad Allison | last post by:
This is a newbie question. I have a combo box in where the end user will select an item (an obedience class - yes for dogs, not for developers) and then assign an obedience judge to that class. ...
1
by: christelwisotzki | last post by:
I want to show HTML with <select multiple="multiple">......</select>. What can I do to make the first selecte item visible
6
by: Smokey Grindle | last post by:
Say I have a combo box with the following simple object Public class MyObject public ID as integer public Name as string public overrides sub ToString() as string return name end sub end...
1
by: wileyboy | last post by:
I have two tables in my databse Table # 1 Item | PriceK | PriceM |Price H | Price T This is populated with items and four prices, these prices are based on a group that the user belongs...
2
by: Christebelle | last post by:
Programming Language: vb6 backend Database is : MSAccess I have two tables the TBLCaveinfo and the TBLDetails. I have a form with a combobox on it. The combobox is populated with the Cavenames in...
6
by: madhuriks | last post by:
hi, im my form...i had 2 combo boxes....if i click one combo box second combo box should be disabled that im doing....its working fine...but my problem is if i want to select both combo boxes how...
10
TheSmileyCoder
by: TheSmileyCoder | last post by:
I have a combobox linked by SQL to a table. The table has standard Primary Key (Autonumber) and text field. There are 3 records: KEY_DocType tx_DocType 1 RMT Document 2 ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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...

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.