private void button2_Click(object sender, EventArgs e) { //add contact Form2 form2 = new Form2(); form2.ShowDialog(); ContactData data = form2.ReturnData(); TestServiceClient client = new TestServiceClient(); try { client.Open(); client.PushContact(data.name, data.number); client.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return; } }