Google Community Chat
 
How do you sum list box contents in vb6?

You're visiting Google Community as a guest.
In order to post, you'll need to register and log in.

(If you were registered and logged in, these advertisements wouldn't be here)
Post new topic   Reply to topic    Google Community Forum Index // Web Design, Coding & Programming Forum
   
Author Message
darrenstraight
Site Admin & Platinum Member
Site Admin & Platinum Member


Joined: 25 Jul 2004
Location: England
173385.09 GC$

Items

PostPosted: Thu Oct 14, 2004 3:07 am    Post subject: How do you sum list box contents in vb6? Reply with quote
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
View user's profile Send private message Visit poster's website
neno.tu
Google Freak
Google Freak


Joined: 10 Oct 2004
Location: Caracas - Venezuela
5951.00 GC$

Items

PostPosted: Thu Oct 14, 2004 4:30 am    Post subject: Reply with quote
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...

Razz
_________________


NenO-tU Freelancer Web Designer and Programmer
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
darrenstraight
Site Admin & Platinum Member
Site Admin & Platinum Member


Joined: 25 Jul 2004
Location: England
173385.09 GC$

Items

PostPosted: Thu Oct 14, 2004 5:18 am    Post subject: Reply with quote
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
View user's profile Send private message Visit poster's website
neno.tu
Google Freak
Google Freak


Joined: 10 Oct 2004
Location: Caracas - Venezuela
5951.00 GC$

Items

PostPosted: Thu Oct 14, 2004 5:22 am    Post subject: Reply with quote
What the VB6 told you?

Where is the error...

Give me your source code...

And tell me what is it then?
_________________


NenO-tU Freelancer Web Designer and Programmer
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
darrenstraight
Site Admin & Platinum Member
Site Admin & Platinum Member


Joined: 25 Jul 2004
Location: England
173385.09 GC$

Items

PostPosted: Thu Oct 14, 2004 5:52 am    Post subject: Reply with quote
Ok neno.tu thank you so much.

Here's the download for the total score part of it:

http://www.darrenstraight.sizzly.com/downloads/vb6/scoreboard.zip

Hope you can solve it, if so let me know if you want anything in return.

Thank you again.
_________________
My Blog | Microsoft Discussion
Back to top
View user's profile Send private message Visit poster's website
neno.tu
Google Freak
Google Freak


Joined: 10 Oct 2004
Location: Caracas - Venezuela
5951.00 GC$

Items

PostPosted: Thu Oct 14, 2004 6:05 am    Post subject: Reply with quote
Hahahahha Allready saw the error... hahahha you toke my example too literaly...


Heheheheh didn't adapt it to your project...

Try update this file

http://m.1asphost.com/nenotu/Form1.frm
_________________


NenO-tU Freelancer Web Designer and Programmer
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
darrenstraight
Site Admin & Platinum Member
Site Admin & Platinum Member


Joined: 25 Jul 2004
Location: England
173385.09 GC$

Items

PostPosted: Thu Oct 14, 2004 6:15 am    Post subject: Reply with quote
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
View user's profile Send private message Visit poster's website
neno.tu
Google Freak
Google Freak


Joined: 10 Oct 2004
Location: Caracas - Venezuela
5951.00 GC$

Items

PostPosted: Thu Oct 14, 2004 6:47 am    Post subject: Reply with quote
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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
darrenstraight
Site Admin & Platinum Member
Site Admin & Platinum Member


Joined: 25 Jul 2004
Location: England
173385.09 GC$

Items

PostPosted: Thu Oct 14, 2004 7:34 am    Post subject: Reply with quote
Ok will do.
_________________
My Blog | Microsoft Discussion
Back to top
View user's profile Send private message Visit poster's website
neno.tu
Google Freak
Google Freak


Joined: 10 Oct 2004
Location: Caracas - Venezuela
5951.00 GC$

Items

PostPosted: Thu Oct 14, 2004 7:42 am    Post subject: Reply with quote
When do you need that... could it be by this night???
_________________


NenO-tU Freelancer Web Designer and Programmer
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
darrenstraight
Site Admin & Platinum Member
Site Admin & Platinum Member


Joined: 25 Jul 2004
Location: England
173385.09 GC$

Items

PostPosted: Thu Oct 14, 2004 8:03 am    Post subject: Reply with quote
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
View user's profile Send private message Visit poster's website
Sponsored Links
Posted: 7 Jan 2009 12:27 pm    Post subject: Advertisements
Back to top
Post new topic   Reply to topic    Google Community Forum Index // Web Design, Coding & Programming Forum All times are GMT - 8 Hours
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Host your free forums with Invision Plus.net forum web hosting with your own subdomain.

alexisBlue v1.2 // Theme Created By: Andrew Charron // Icons in Part By: Travis Carden

© 2005-2006 Google Community

Powered by phpBB

Privacy Policy | Contact Us

Powered by Google Search blog

This website is not affiliated in any way with Google, Inc.
Google™ is a registered trademark of Google, Inc.