Timer 를 이용하여 일정시간마다 작업을 할수 있습니다.
전체 소스 :
아래는 주요 소스 입니다.
=================================================================
public partial class frmMain : Form
{
Timer m_tmrCount;
public frmMain()
{
m_tmrCount = new Timer();
m_tmrCount.Tick += new EventHandler(m_tmrCount_Tick);
InitializeComponent();
}
private void btnStart_Click(object sender, EventArgs e)
{
m_tmrCount.Interval = 1000;
m_tmrCount.Start();
}
void m_tmrCount_Tick(object sender, EventArgs e)
{
if (null == txtCount.Text || "" == txtCount.Text)
txtCount.Text = "0";
txtCount.Text = (Convert.ToInt32(txtCount.Text) + 1).ToString();
}
private void btnStop_Click(object sender, EventArgs e)
{
m_tmrCount.Stop();
}
private void btnClear_Click(object sender, EventArgs e)
{
txtCount.Text = "0";
}
}
- [2018/02/26] List 에서 고유값 얻기 ()
- [2015/05/22] C#, 아두이노 간의 WIFI 통신으로 LCD 제어 (4566)
- [2015/03/13] 항상 마지막에 추가한 TEXT 보이게 ()
- [2014/01/17] ComboBox Text 편집 안되게 (14491)
- [2014/01/08] if 문에서 여러개 비교할때 (25341) *3
- [2013/12/30] C++, C# 간단한 기능 비교 (12885)
- [2013/12/18] 3자리마다 ,(콤마) 찍기 (원화, 달러 표시) (15224)
- [2013/09/29] 설치된 IE 버전 얻기 (12399)
- [2013/08/29] byte array to Hexa String (13026)
- [2013/06/25] string array to string (스트링 문자열 합치기) (23714)