![]() |
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 |
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? |
| All times are GMT -5. The time now is 2:39 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC