开发者

Timer Tick event suddenly not working

Yesterday I was working on a project and using a timer. Today I went to the same project and the timer no longer works! I thought it may be a logic error (no syntax or runtime errors reported) but I do not know what is going on. The timer's interval is set to 2000, it's called when a button is clicked, and is supposed to show a messagebox. It's not working and I'm going out of my mind!

The snippet of code that handles the timer is here:

    private void buttonFindColor_Click(object sender, EventArgs e)
    {
        // start the timer
        timerMain.Start();
    }

    private void timerMain_T开发者_JS百科ick(object sender, EventArgs e)
    {
        MessageBox.Show("I ticked!");

        timerMain.Stop();
    }


There's a chance the Tick event is not "wired" to the timer.

Does this line exist anywhere?

timerMain.Tick += timerMain_Tick;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜