| |
darrenstraight Site Admin & Platinum Member


Joined: 25 Jul 2004 Location: England 173385.09 GC$
Items
|
Posted: Thu Oct 14, 2004 3:07 am Post subject: How do you sum list box contents in vb6? |
|
|
|
Please help me my fellow freinds.
Im doing a project at college were I have to make a scoreboard in visual basic 6.
On this scoreboard I will have a final form that will calculate the total of all the scores added in to list box when somebody clicks the command button saying "calculate total" all the values in the list box will be numbers.
Now has anybody any idea how I could do this.
Here's an example of what the form would look like:
Thank you in advance. _________________ My Blog | Microsoft Discussion |
|
| Back to top |
|
|
neno.tu Google Freak

Joined: 10 Oct 2004 Location: Caracas - Venezuela 5951.00 GC$
Items
|
Posted: Thu Oct 14, 2004 4:30 am Post subject: |
|
|
|
Yeah man... .NET Rocks but VB6 is good stuff too..
You wanna get the total from a List box?
hmmm let me see...
| Code: |
Dim ListBox1 As ListBox
Dim TexBox1 As TextBox
Dim Result, i, max As Integer
Result=0
i=0
max=ListBox1.Items.length
For i=0 to max
Result = Result + Val(ListBox1.Items(i).text)
Next
'Then Result will be the RESULT of the adding
TextBox1.Text = Result
|
Hope it helps...
 _________________
NenO-tU Freelancer Web Designer and Programmer |
|
| Back to top |
|
|
darrenstraight Site Admin & Platinum Member


Joined: 25 Jul 2004 Location: England 173385.09 GC$
Items
|
Posted: Thu Oct 14, 2004 5:18 am Post subject: |
|
|
|
Booo hoooo hoo
It did'nt work, Come on everybody show me how to do it. Or even provide me a download sample.
Or something I really need this to work if not it's back to the drawing board. _________________ My Blog | Microsoft Discussion |
|
| Back to top |
|
|
neno.tu Google Freak

Joined: 10 Oct 2004 Location: Caracas - Venezuela 5951.00 GC$
Items
|
|
| Back to top |
|
|
darrenstraight Site Admin & Platinum Member


Joined: 25 Jul 2004 Location: England 173385.09 GC$
Items
|
|
| Back to top |
|
|
neno.tu Google Freak

Joined: 10 Oct 2004 Location: Caracas - Venezuela 5951.00 GC$
Items
|
|
| Back to top |
|
|
darrenstraight Site Admin & Platinum Member


Joined: 25 Jul 2004 Location: England 173385.09 GC$
Items
|
Posted: Thu Oct 14, 2004 6:15 am Post subject: |
|
|
|
Thanks for that, but it's still not working for me, so I quiting the List box I think and Ill find some other way where variables are stored into something and then added all togehter, but thanks anyway.
Now how could I do it...
*darren scratches his head wondering. _________________ My Blog | Microsoft Discussion |
|
| Back to top |
|
|
neno.tu Google Freak

Joined: 10 Oct 2004 Location: Caracas - Venezuela 5951.00 GC$
Items
|
Posted: Thu Oct 14, 2004 6:47 am Post subject: |
|
|
|
I don't have the VB6 here... that's why I couldn't test it...
But you can still do it with the ListBox... Just give me a few minutes... _________________
NenO-tU Freelancer Web Designer and Programmer |
|
| Back to top |
|
|
darrenstraight Site Admin & Platinum Member


Joined: 25 Jul 2004 Location: England 173385.09 GC$
Items
|
|
| Back to top |
|
|
neno.tu Google Freak

Joined: 10 Oct 2004 Location: Caracas - Venezuela 5951.00 GC$
Items
|
|
| Back to top |
|
|
darrenstraight Site Admin & Platinum Member


Joined: 25 Jul 2004 Location: England 173385.09 GC$
Items
|
Posted: Thu Oct 14, 2004 8:03 am Post subject: |
|
|
|
I dont need it until the end of this week at the latest. As I can carry on with the rest of it. _________________ My Blog | Microsoft Discussion |
|
| Back to top |
|
|
Sponsored Links
|
Posted: 5 Dec 2008 9:15 am Post subject: Advertisements |
|
|
|
|
|
|
| Back to top |
|
|