是我第一次使用定時器,所以可能我做錯了什麼。定時器不工作
我的代碼是這樣的:
private void timer1_Tick(object sender, EventArgs e)
{
button2.PerformClick();
}
private void button2_Click(object sender, EventArgs e)
{
// random code here
timer1.Interval = 5000;
timer1.Start();
timer1_Tick(null,null);
}
我想這是做:執行任意代碼,然後等待計時器的時間間隔和執行週期(即會做一個「點擊」在再次按鈕,再次執行相同的操作),然後重複此操作。
對不起,如果是一個容易的錯誤,我從這開始,不知道我做錯了什麼。
謝謝您的閱讀! :D
好吧.. http://meta.stackexchange.com/questions/10647/writing-a-good-title –
究竟是什麼不起作用?這段代碼似乎有一個無限循環。 –