Timer won't tick

前端 未结 7 1760
一整个雨季
一整个雨季 2020-12-10 03:31

I have a Windows.Forms.Timer in my code, that I am executing 3 times. However, the timer isn\'t calling the tick function at all.

private int co         


        
7条回答
  •  独厮守ぢ
    2020-12-10 03:34

    Try using System.Timers instead of Windows.Forms.Timer

    void Loopy(int times)
    {
        count = times;
        timer = new Timer(1000);
        timer.Enabled = true;
        timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
        timer.Start();
    }
    
    void timer_Elapsed(object sender, ElapsedEventArgs e)
    {
        throw new NotImplementedException();
    }
    

提交回复
热议问题