praveen kumar

praveen kumar

  • NA
  • 36
  • 21.2k

Threads Using In WinApps

Nov 28 2015 1:49 AM
Hi good afternoon ,
i created one Form1 inside Form1 create one button1  when i click button new Form2 will open
and it will terminate after 3 minutes  i am using timer control and set time working good 
i took one label in Form2 and add Decrese Time  02:59 Min and seconds format ,what ever i wrote code working good,
but I want to time interval put threads process how we add to thread this code
if any body knows please replay me 
Thanks in Advance. 
 
//Form1 Button Code 
private void button1_Click(object sender, EventArgs e)
{
Form2  fr = new Form2();
fr.ShowDialog();
}
 //Form2 Code 
 
private void Form4_Load(object sender, EventArgs e)
{
timer1.Interval = 1000;
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Enabled = true;
timer1.Start();
}
void timer1_Tick(object sender, EventArgs e)
{
seconds--;
label1.Text = ((seconds / 60).ToString().Length == 2 ? (seconds / 60).ToString() : "0" + (seconds / 60).ToString()) + ":" + ((seconds % 60).ToString().Length == 2 ? (seconds % 60).ToString() : "0" + (seconds % 60).ToString());
if (seconds == 0)
{
this.close(); 
}
}
 

Answers (1)