private void button3_Click(object sender, EventArgs e) { //remove contact int index = dataGridView1.CurrentRow.Index; TestServiceClient client = new TestServiceClient(); try { int number = Convert.ToInt32(dataGridView1.Rows[index].Cells[1].Value.ToString()); client.Open(); client.DeleteContact(number); client.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }