static void Main(string[] args) { calculation cal = new calculation(); int i = cal.Add(23, 37); int i2 = cal.Sub(28, 12); Console.WriteLine("addition result is : {0}", i); Console.WriteLine("substruction result is : {0}", i2); Console.ReadLine(); }
private void button2_Click(object sender, EventArgs e) { try { int i = cal.Sub(int.Parse(textBox1.Text), int.Parse(textBox2.Text)); textBox3.Text = i.ToString(); } catch (Exception ex) { MessageBox.Show("error in add button event..." + ex); } }