473,587 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add the values of a listbox

8 New Member
Hi all. Lets just say I have a listbox of full of values. Can someone help me write some code to add all the numerical values of the listbox? Thanks
Dec 14 '07 #1
5 1488
debasisdas
8,127 Recognized Expert Expert
What do you mean by all the numerical values of the listbox .
What exactly are you trying to do ?
Dec 14 '07 #2
ss112358
8 New Member
What do you mean by all the numerical values of the listbox .
What exactly are you trying to do ?
Thankyou for your reply. I have a listbox with numerical values that the user enters. I then want to find the total sum of all the values in the listbox.

Thanks again
Dec 14 '07 #3
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

Loop from 0 to (List1.ListCoun t-1) and write the code to add..


Regards
Veena
Dec 14 '07 #4
ss112358
8 New Member
Hi,

Loop from 0 to (List1.ListCoun t-1) and write the code to add..


Regards
Veena
Can you please give me an example? I am getting confused.. Thanks
Dec 14 '07 #5
debasisdas
8,127 Recognized Expert Expert
Can you please give me an example? I am getting confused.. Thanks
There is nothing to get confused. Retrive all the values using the listindex peoperty . You need to add the values in a loop. You will not learn anything till you try yourself.

Kindly post what you have tried so far for further discussion on the topic.
Dec 14 '07 #6

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

Similar topics

7
2574
by: Dave Hopper | last post by:
Hi I posted a question recently regarding problems I am having getting a value from a list box to use in a query. I got a lot of help, for which I thank you and it's nearly working! But I need a little more help on one more point. This is what i've got. I have code that hunts for updated appointments in a public folder based on the...
1
1614
by: dburns | last post by:
I have an unbound ListBox and an unbound ComboBox on the same form. I have them both set up to display the values from the same field in the same table. The ListBox displays the correct values; the ComboBox displays nothing. The form is just a test form I'm using to sort this problem out. It has no other controls on it and no code...
6
5200
by: Janaka | last post by:
Help! I have two ListBox controls on my web form. The first one gets populated on entry with values from the DB. I then use JavaScript to copy options from this ListBox to my second one. (I have also tried changing the second ListBox to an HtmlSelect control) using bog standard JavaScript code like so where "used" is the name of my...
6
2650
by: Niggy | last post by:
Hi there, I would like to display the values of the index as chosen by the user in a listbox. These values would be as per the datavaluefield. On testing I get a value of -1: Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged Me.Label1.Text =...
0
1680
by: Dave | last post by:
Hi all, I have a listbox that is complex bound by an arraylist. The problem is that when I delete an object from the arraylist, the listbox does not reflect those changes. I tried refreshing the listbox with no luck and, because it is already bound, I can't just delete the item directly from the listbox without an error (because it already...
7
4073
by: technocraze | last post by:
Hi guys, I encountered this error while using the AfterUpdate event for my listbox. Error: Update or CancelUpdate without using AddNew or Edit. What i wanted to achieve is just to display the selected values from the listbox into the textboxes. I have bounded both my listbox and textbox to the controlSource of the field of my table. I have...
1
2488
by: Intrepid_Yellow | last post by:
Hi, I have the following code that runs my report generator. The user selects a table from a combo box, then whatever fields they want from a list box. (This part all works and the report runs fine). There is then a combo box they can select a field from (eg CompanyID etc) and then the list box below that contains the values (eg Microsoft,...
1
2019
by: melvincwmah | last post by:
I have a form in which I would link the form fields to tables in the SQL database. Right now, I want to put in a listbox that will show three columns from a table called IssueAudit. The conditions for my listbox are: 1. The three columns (dubbed as Change History) are taken from IssueAudit under conditions that the ChangedFields value is...
6
4155
by: Pippen | last post by:
Hi, I'm trying to read all the selected items in a ListBox. So after the user selects the values they want in the ListBox they select a button. This is where I want to put into a string all the values that were selected. The ListBox is populated by a stored proc that reads a DB table. Yes, I have the SelectionMode property set to...
3
3755
by: Renilkumar | last post by:
Hi, I am using .net 2.0. I have a .aspx page with vb.net as codebehind. My form has one dropdown, 2 listboxes with add & remove button. During pageload I am loading all the values from the db to dropdown and after pageload, If I select value from the dropdown will load the data into the first listbox. I can select 1 or multiple values in the...
0
7920
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7849
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8215
Oralloy
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. ...
0
8347
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7973
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...
0
8220
tracyyun
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...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.