Multithread

AFC08

Newcomer
Joined
Feb 24, 2009
Messages
3
The application is basically this:
I have three buttons in my form, lets say Btn1, Btn2 and Btn3.
Everytime i click btn1 i start ThreadA. ThreadA reads certain msg from my DB and displays them in the form textbox. If i click on Btn2, ThreadA is stopped and THreadB starts, which shows different messages. This way, if i click on Btn1 again I start the process where i got interrupted.
When I pres Btn2 and ThreadB has started i have two options: If i click on Btn3 then in relation to the msg i have currently displayed I will display another one, however if i keep it pressed for more than 2 seconds i will be going thru a loop of messages and then go back to the point where the process from Btn2 was interrupted, and if this time goes more than 2 min than everythings gets stopped.

I have tried to use the timer so i can imitate the idea of holding a button (not just cliking it), but it doesnt work well. I made the timer interval = 2000 (for 2 sec), but it keeps calling the thread every 2 sec. That is not what i want.
I want to have a timer in the background which count the seconds that are passing when the button_mousedown function is called.

Can anyone help please??
 
I looked at the Stopwatch function but the problem i was facing was that once i press down on the button i start the watch, but i need to have a loop while the time is being counted (so i want a real time count of the seconds, once it hits the value i want i will call my thread but i dont want to stop the watch because if the time goes more than 2 min i need to stop everything).

How can i do this with Stopwatch?? I tried, but it wasnt working..
Any help will be great.
Thank you all
 
Back
Top