I want to press the button and wait till the timer hits 0, so it will paste whatever is in the text box, but i want another button to paste from another textbox using the same timer. Right now i only managed to solve it by having one timer for each button.
Don’t instantiate the timer in Onclick. Do just one on form load and start it immediately. Use a form level variable for each button. Onclick, store a “start time” for the button. In timer tick, check each variable for a value greater than zero and (current time minus start time) greater than your desired duration. When the duration passes, set the variable to zero first, so it won’t fire again and then do your sendkey. For elapsed time you can start a Stopwatch alongside your timer at form level and use Elapsed milliseconds.
C# devs
null reference exceptions