예제 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (flag == 1)
            {
                try
                {
                    Error_message er = new Error_message();
                    counter = int.Parse(this.textBox1.Text);
                    if (counter < 0)
                    {
                        er.show("Imagine if time can actually go backwards!");
                    }
                    else
                    {
                        timer1          = new System.Windows.Forms.Timer();
                        timer1.Tick    += new EventHandler(timer1_Tick);
                        timer1.Interval = 1000; // 1 second
                        timer1.Start();

                        label2.Text = counter.ToString();
                        flag        = 0;
                    }
                }
                catch (System.FormatException)
                {
                    Error_message er = new Error_message();
                    er.show("Enter time limit for timer");
                };
            }
        }
예제 #2
0
 private void button16_Click(object sender, EventArgs e)
 {
     try
     {
         incre = int.Parse(textBox1.Text);
         decre = int.Parse(textBox2.Text);
     }
     catch (Exception)
     {
         Error_message er = new Error_message();
         er.show("Input the values of increment and decrement");
     }
 }
예제 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         timer1.Stop();
         flag        = 1;
         label2.Text = "0";
         player.Stop();
     }
     catch (Exception)
     {
         Error_message er = new Error_message();
         er.show("Timer is not running");
     }
 }