博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

异步事件

Posted on 2014-04-09 11:17  hyd309  阅读(409)  评论(0编辑  收藏  举报
private void button4_Click(object sender, EventArgs e)
        {
            System.Threading.Thread thread = new System.Threading.Thread(
               new System.Threading.ThreadStart(AdDepartmentNumber)
               );
            thread.Start();

            timer1.Enabled = true;
            timer1.Start();   
        }
        void AdDepartmentNumber()
        {
            try
            {
               
               //执行的内容
            }
            catch (Exception ex)
            {
                //日志
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
//要执行的方法
}