private void buttonAdd_Click(object sender, EventArgs e) { txtResult.Text = string.Empty; try { _client = new MathClient(); if (radInt.Checked) { int x = Convert.ToInt32(txtX.Text.Trim()); int y = Convert.ToInt32(txtY.Text.Trim()); txtResult.Text = _client.Add(x, y).ToString(); } else if (radDouble.Checked) { double x = Convert.ToDouble(txtX.Text.Trim()); double y = Convert.ToDouble(txtY.Text.Trim()); txtResult.Text = _client.AddDouble(x, y).ToString(); } } catch (Exception ex) { txtStatus.Text = ex.GetType().ToString(); MessageBox.Show(ex.Message, "Exception"); } }
private void btnAdd_Click(object sender, EventArgs e) { try { int v1 = int.Parse(txtValue1.Text); int v2 = int.Parse(txtValue2.Text); //Call the proxy to add int result = proxy.Add(v1, v2); //Display label3.Text = string.Format("{0} + {1} = {2}", v1, v2, result); } catch (FormatException fe) { MessageBox.Show(fe.Message); } }