First button click to start timer, second to stop

前端 未结 5 661
独厮守ぢ
独厮守ぢ 2021-01-28 05:04

I\'m struggling with making button first click to start a timer, second click to stop the timer and etc.

Can anybody help me? :)

private void button7_Cli         


        
5条回答
  •  囚心锁ツ
    2021-01-28 05:32

    Assuming you're using the System.Timers.Timer class, simply use:

    private void button8_click(object sender, EventArgs e)
    {
        timer1.Stop();
    }
    

    See the MSDN page for more handy methods!!

提交回复
热议问题