0
101 Apr 18, 2007 at 09:23

I have some figures in a listbox and would like all the values to be added together. Any one how i would go about that?

#### 9 Replies

0
101 Apr 18, 2007 at 09:34

No. The question is too vague.
What language/api are you using?
It’s probably very easy to do, and it shows that you don’t really understand how to program.
Perhaps you should look at some programming tutorials. If you’re using C/C++ look up for/while loops.

int total = 0
for each item in listbox
total = total + atoi(item.value) // atoi to convert from string to integer

0
101 Apr 18, 2007 at 09:37

sorry i am using using vishual studio 2005

0
101 Apr 18, 2007 at 09:43

That doesn’t help anything. First of all, Visual Studio represents a whole suite of different languages (C++, C#, VB.Net, …). Secondly, you don’t describe the problem at hand. What is your exact problem? Give us a detailed description and show us the code you already have. What results are you getting from that code? And what are you expecting to get?

If you can’t answer these questions we can’t help you. If you’re just looking for someone to implement it for you you have come to the wrong place.

0
101 Apr 18, 2007 at 09:43

Last time I looked, visual studio supported C++, C#, J# and visual basic.

Sounds like you can’t program at all. I’m afraid you’re asking the wrong questions if you want to learn how to program.

0
101 Apr 18, 2007 at 09:46

i am using visual studio, vishual basic 2005. I am trying to get values from a listbox which are figures and add them together. I no i am new to this and am doing this as part of a school project. Thank you

0
101 Apr 18, 2007 at 09:47

I am trying to get values from a listbox which are figures and add them together

Show us your sourcecode. And of course only the relevant part, e.g., the function that needs to add the elements of the listbox together.

0
101 Apr 18, 2007 at 09:49

this is the code i am using to populate my listbox

If com1.Text = “Bond Street” Then
objConnection.Open()
Dim strSql As String = “SELECT * from Feedback WHERE Attractionname = ‘Bond Street’” Dim objCommand As New System.Data.OleDb.OleDbCommand(strSql, objConnection)
End While
End If

the items in listbox2 are all figures and i want them to be added together

0
101 Apr 18, 2007 at 09:54

For Each item as Object in ListBox2.Items