private void button2_Click(object sender, EventArgs e) { StudentService.StudentServiceClient client = new StudentService.StudentServiceClient("NetTcpBinding_IStudentService"); try { StudentService.Student student = new StudentService.Student() { Name = textBox2.Text, DateOfBirth = Convert.ToDateTime(textBox3.Text), Gpa = Convert.ToDouble(textBox4.Text) }; if (client.AddStudent(student)) { lblShow.Text = "Add Student Success."; } else { lblShow.Text = "Add Student Fail."; } clearText(); } catch (Exception er) { clearText(); lblShow.Text = "Error : " + er.ToString(); } }