🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Burak HABER / C# / 128. Try Catch Bloğu Kullanımı

1-) C# - 128. Try Catch Bloğu Kullanımı

using System;

using System.Windows.Forms;

 

namespace _128TryCatchBloguKullanimi

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void button1_Click(object sender, EventArgs e)

        {

            try

            {

                int sayi1 = Convert.ToInt32(textBox1.Text);

                int sayi2 = Convert.ToInt32(textBox2.Text);

                int toplam = sayi1 + sayi2;

                MessageBox.Show(toplam.ToString());

            }

            catch (Exception)

            {

                MessageBox.Show("Lütfen değerlerinizi kontrol edin!");

            }

        }

    }

}

 2021 Mart 11 Perşembe
 421