10
Answers

How to have multiple timers in dataGridView each row?

Tommy

Tommy

7y
541
1
Hi everyone,
 
Please, I need you guys. I’m completely stuck with my code. I’m trying to create an app that has a countdown for user tasks. Once the countdown completed, holds 00:00:00, checks in MySQL, if there’s a new time added for that record. If Time_remain 0, then another timer keep checking every 30 secs it it’s been updated.
 
I have a dataGridView and data source is MySQL database. MySQL table contains Id, Taskname,Time_Remain (here goes time in format eg. 36000 = 6 mins).
 
 
A little bit, how the form should work.
 
Form loads 1st time > Loads current results from MySQL> If Time_remain is not 0 then timer even for that row starts the countdown.
 
First, I’d like to know, which method is best to use? Multithread?
 
I have the whole code to get info from MySQL. I even know, how to do this countdown if I had only one record. However, I cannot work it out, how to create the fallowing:
 
1) Dynamic timer for each dataGridView result (row), which has a countdown (Time Remaining). NOTE: I don't want to check MySQL every second
 
2) Have another timer event working, which starts once the countdown on that row reaches 00:00:00
 
I've been searching online and discovered that this can be done with:
private Dictionary
Or something similar, but I honestly have no clue. I've tried many variations but none of them function like I would like to. Keep in mind, the number of records taken MySQL changes. Not just 4 records, like in the picture.
 
I don't know, if you guys have more ideas, ways to do this and same time keep application usage (pc cpu, memory) low?
 
I have attached my project file for you and a screenshot, how the app would look visually.
 
 
 
 
 

Attachment: taskmanager.zip

Answers (10)