Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 28th, 2004, 6:03 PM   #1
masanovic
Newbie
 
Join Date: Nov 2004
Posts: 6
Rep Power: 0 masanovic is on a distinguished road
A user is required to select an activity from a combo box, then type in a number of hours in a text box, and then click add. The activity is inserted into the activity listbox, and the hours into the hours listbox. I have code that totals all the hours in the listbox, this works fine. But now I need to add all the hours that I have for particular activites. For example, if i have the following

Activity Hours

Analysis 4
Design 2
Implementation 2
Design 3
Analysis 2
Documentation 5
Design 3

Now I want to add the total number of hours where the activity is say analysis and documentation and put the result in a label. Therefore ignoring the hours that are not those particular activities
masanovic is offline   Reply With Quote
Old Dec 13th, 2004, 2:55 AM   #2
Xyler
Newbie
 
Join Date: Sep 2004
Location: South Africa, Eastern Cape
Posts: 28
Rep Power: 0 Xyler is on a distinguished road
Just iterate through the list as you normally would. The only difference is iterate through the activity list. Using a simple if statement, check if it matches any of your criterion. If it does get the value out of the other list using the same index. Just add these. If it doesn't match don't add it to your total.

This is rather simple, so are you just looking for someone to code for you or did you genuinely not know?
__________________
Be vewwy vewwy quiet. I'm hunting wuntime ewwors.
Xyler is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:18 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC