2014년 6월 28일 토요일

[c#]1분 간격으로 이벤트 실행

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Timers;

namespace sendgmail
{
    public partial class Form1 : Form
    {
        static System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
       
        public Form1()
        {
            InitializeComponent();

            timer.Tick += new EventHandler(timer_Tick); // Everytime timer ticks, timer_Tick will be called
            timer.Interval = 60 * 1000;
            timer.Enabled = true;                       // Enable the timer
            timer.Start();    

  
        }

        // 쓰레드풀의 작업쓰레드가 지정된 시간 간격으로
        // 아래 이벤트 핸들러 실행
        private void timer_Tick(object sender, EventArgs e)
        {
            // MessageBox.Show("timer success");

        }

    }
}

댓글 없음:

댓글 쓰기