anx adlı üyeden alıntı: mesajı görüntüle
Merhaba,

Olası hata yakalama işlemlerini de içeren ufak bir uygulama örneği yazdım.

Yapmanız gereken formunuza 2 adet label(zorunlu değil, görsel açıdan dakika ve saniye kutucuklarını isimlendirmek için), 2 adet textbox ve 1 adet buton koymanızdır.

 public partial class Form1 : Form
    {
        int dakika;
        int saniye;

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text == string.Empty && textBox2.Text == string.Empty)
                {
                    MessageBox.Show("Dakika ve saniye alanları boş bırakılamaz");

                }

                if (textBox1.Text == string.Empty && textBox2.Text != string.Empty)
                {
                    MessageBox.Show("Dakika alanı boş bırakılamaz");

                }

                if (textBox1.Text != string.Empty && textBox2.Text == string.Empty)
                {
                    MessageBox.Show("Saniye alanı boş bırakılamaz");

                }

                if (textBox1.Text != string.Empty && textBox2.Text != string.Empty)
                {
                    if (int.Parse(textBox1.Text) == 0 && int.Parse(textBox2.Text) == 0)
                        MessageBox.Show("Geri sayım için uygun değerler kullanmıyorsunuz");
                }

                if (textBox1.Text != string.Empty && textBox2.Text != string.Empty)
                {
                    if (int.Parse(textBox1.Text) >= 0 && int.Parse(textBox2.Text) <= 59 && int.Parse(textBox2.Text) != 0)
                    {
                        textBox1.ReadOnly = true;
                        textBox2.ReadOnly = true;
                        button1.Enabled = false;

                        dakika = int.Parse(textBox1.Text);
                        saniye = int.Parse(textBox2.Text);

                        timer1.Interval = 1000;
                        timer1.Tick += new EventHandler(timer1_Tick);
                        timer1.Start();
                    }
                }

                if (textBox1.Text != string.Empty && textBox2.Text != string.Empty)
                {
                    if (int.Parse(textBox1.Text) >= 0 && int.Parse(textBox2.Text) > 59)
                        MessageBox.Show("Saniyede yanlış değer kullanıyorsunuz");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Sadece sayısal değer girebilirsiniz");
                textBox1.Text = string.Empty;
                textBox2.Text = string.Empty;
            }
        }
        void timer1_Tick(object sender, EventArgs e)
        {
            if (dakika > 0 && saniye == 0)
            {
                dakika--;
                saniye = 60;

                textBox1.Text = dakika.ToString();
            }
            if (dakika > 0 && saniye <=60 && saniye != 0)
            {
                saniye--;

                textBox2.Text = saniye.ToString();
            }
            if (dakika == 0 && saniye <= 60 && saniye != 0)
            {
                saniye--;

                textBox2.Text = saniye.ToString();
            }

            if (dakika == 0 && saniye == 0)
            {
                timer1.Stop();
                MessageBox.Show("Geri sayım bitti.");
                Application.Restart();
                
                
            }
            
        }
    }
Teşekkürler.

Çok teşekkür ederim konu kilitlenebilir.