I have Form with a Timer1.
I would like to set the Tick event of that timer1 to a timer2_Tick
function that is already signed to another timer2.
How can I Set the 2 timers, to 1 event?
So the answer is - yes you can :) However, I'd recommend to use unobtrusive JavaScript.. mixing js with HTML is just nasty.
Given multiple functions, the task is to call them by just one onclick event using JavaScript. Here are few methods discussed. Either we can call them by mentioning their names with element where onclick event occurs or first call a single function and all the other functions are called inside that function.
To call multiple functions onClick in React: Set the onClick prop on the element. Call the other functions in the event handler function. The event handler function can call as many other functions as necessary.
What would be the equivalent for making two function calls onClick in ReactJS? Very simple: pass a function that calls the two functions, just like you would to with ele. onclick = ... or addEventListener .
You do it the same way you assign any other event handler, you just happen to choose the same method for both timers.
System.Windows.Forms.Timer first = new System.Windows.Forms.Timer();
first.Tick += tick;
System.Windows.Forms.Timer second = new System.Windows.Forms.Timer();
second.Tick += tick;
private void tick(object sender, EventArgs e)
{
throw new NotImplementedException();
}
If you're using the designer, instead of attaching the events through code, then you can just go to the "Properties" tab, select events, and enter the same name for the Tick
event for both timers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With