我有一个从路由器读取数据的软件。
一切都在工作-但我必须按一个名为“刷新”的 buton,如果我想看到数据刷新...
这应该在后台工作后,我已经连接到设备。
我怎样才能自动做到这一点-每 10 秒?
我试过这个:Add timer to a Windows Forms application
看来我的代码不知道System.Windows.Forms.Timer
类。
Use System.Windows.Forms.Timer class
private Timer timer1;
public void InitTimer()
{
timer1 = new Timer();
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Interval = 10000; // 10 seconds / 10000 MillSecs
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
isonline();
}
感谢Execute specified function every X seconds中的 Stecya
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(61条)