How to add two numbers in c# .Net window application

Step 1.

Create a New Window Application Form in Microsoft Visual Studio.

create window

Step 2.

Design your Window Application Form like below form.

add form

Step 3.

Now double click on Submit Button and write below coding.

   
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;

    namespace WindowsFormsApplication1
    {
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        //submit button coding
        private void button1_Click(object sender, EventArgs e)
        {
            int a, b, c;
            a = Convert.ToInt32(textBox1.Text);
            b = Convert.ToInt32(textBox2.Text);
            c = a + b;
            textBox3.Text = c.ToString();
        }
        }
    }
    

Output:

add output

Watch Tutorial Video on YouTube

Watch and Subscribe Now

Post Your Comment