在特定时间执行函数c# [英] execute function at specific time c#

查看:145
本文介绍了在特定时间执行函数c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用winForm c#

我想知道如何在特定时间调用或执行函数?

I work with winForm c#
and i want to know how can i call or execute a function at specific time?

推荐答案

您可以使用计时器。但是,我建议使用Windows任务计划程序。
You might use a timer for the purpose. However I recommend using the Windows Task Scheduler instead.


除了解决方案1之外,请查看我以前的答案,了解更多详情:

问题窗口服务 [ ^ ]



-SA
In addition to Solution 1, please see my past answer, for more detail:
Problem a Window Services[^]

—SA


您好,在您的窗口中添加控制计时器,然后双击它,插入您想要运行的功能,在计时器的属性上必须以毫秒表示执行时间



例如

private void timer1_Tick(object sender,EventArgs e)

{

timer1.Start();

/ /函数名称();

timer1.Stop();

}



Vanzetty Durant
Hi, In your window form add the control timer, then giving double click on it, insert the function that you want to run, on the property of the timer must indicate the execution time in milliseconds

  eg
  private void timer1_Tick (object sender, EventArgs e)
  {
             timer1.Start ();
             / / Function name ();
             timer1.Stop ();
  }

Vanzetty Durant


这篇关于在特定时间执行函数c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆