private void btnAdd_Click(object sender, EventArgs e) { /* * add two controls in the form and rename the 'name' property as txtA and txtB * add a button control and rename it to btnAdd, then double click the button, visual studio IDE wll add this event code for you * and you add your logic in this code block as below. */ int a = Convert.ToInt32(txtA.Text.Trim()); // convert to int .. explore int.TryParse for validation int b = Convert.ToInt32(txtB.Text.Trim()); // convert to int .. explore int.TryParse for validation int sum = a + b; MessageBox.Show("the sum is=" + sum.ToString()); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)