static void Main(string[] args) { TestServiceClient client = new TestServiceClient(); client.Open(); int number = 12345600; Console.WriteLine(client.SearchName(number)); Console.ReadLine(); client.Close(); }
private void button5_Click(object sender, EventArgs e) { //search name dataGridView1.Rows.Clear(); Form2 form2 = new Form2(1); form2.ShowDialog(); ContactData data = form2.ReturnData(); TestServiceClient client = new TestServiceClient(); try { client.Open(); string name = client.SearchName(data.number); client.Close(); if (name != null) dataGridView1.Rows.Add(name, data.number.ToString()); else { foreach (Control c in Controls) c.Enabled = false; button1.Enabled = true; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }