Example #1
0
        private void btnselfhosting_Click(object sender, EventArgs e)
        {
            int n  = int.Parse(txtnum1.Text);
            int n1 = int.Parse(txtnum2.Text);

            try
            {
                ServiceReference2.CalculatorClient cc = new ServiceReference2.CalculatorClient();
                var Add = cc.Add(n, n1);
                var Sub = cc.Sub(n, n1);
                MessageBox.Show("Addition:" + Add);
                MessageBox.Show("Subtraction:" + Sub);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int n  = int.Parse(txtNum1.Text);
            int n1 = int.Parse(txtNum2.Text);

            try
            {
                ServiceReference2.CalculatorClient cc = new ServiceReference2.CalculatorClient(); // interface cant create object soooo Google

                var add = cc.Add(n, n1);
                var sub = cc.Sub(n, n1);

                MessageBox.Show("Addition : " + add);
                MessageBox.Show("Subtraction : " + sub);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }