Click here to Skip to main content
15,889,739 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I'd like to know the best solution to creating a listbox with timers for each section. So in my application when someone requests a auditor it triggers a start time. I have 152 sections and management would like a visual management of how long each block is taking with a live timer. so it would look like this

Section name | Time (min) |
---------------------------|
Section 1 | 04:10 |
---------------------------|
Section 2 | Not started |
---------------------------|
Section 3 | 15:70 |
---------------------------|

sorry did it in ascii lol but this is what I am trying to do and then when that section is complete it should stop the timer.

Would I need 152 different timers or is their a better way of doing this

What I have tried:

I haven't tried anything this is just an idea that i'd like to do but don't know how to start.
Posted
Updated 23-Nov-19 22:52pm

Use one timer, add the "auditor" (whatever that is) to a List of items for the timer to check, and check through the whole list in teh Tick event handler.

Alternatively, set up a second Thread which monitors the list and does the timing for you without using a Timer at all. This is "better" from a UI performance POV as is takes the work away from the UI thread, but a lot more complex in that the Listbox text update needs to be Invoked back onto the original thread to avoid a cross threading exception.
 
Share this answer
 
Comments
Knowledged 22-Nov-19 14:15pm    
auditor would just be a person. Do you have an example where this is done, I am unable to find anything like what I am trying to do
OriginalGriff 23-Nov-19 4:17am    
"Person"s don't live in computer programs - you need to be more specific about your terms as we don't get anything except exactly what you tell us to work from, we get no wider context of your project!

You do understand timers, collections, and threads, I assume? So which part is giving difficulties?
Knowledged 25-Nov-19 7:55am    
so when a user clicks a button it starts the timer in the list of that specified section. The UI is a map with 152 buttons which is 152 sections. So when a user clicks a button saying auditing is done for this section it starts the timer then when a second user clicks a different button it will stop the timer declaring the length of the process. Does this make more sense?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900