private void btnSearch_click(Object sender, EventArgs e) { try { found = managerActiviti.findStudentById(int.Parse(txtId.Text)); } catch (ObjectNotFoundException) { MessageBox.Show("legajo inválido", " eror", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void btnSearch_click(Object sender, EventArgs e) { try { found = managerActiviti.findStudentById(int.Parse(txtId.Text)); } catch (ObjectNotFoundException) { MessageBox.Show("estudiante no enconrado", "legajo no bálido", MessageBoxButtons.OK, MessageBoxIcon.Information); FRMDeleteStudent f = new FRMDeleteStudent(managerActiviti); f.ShowDialog(); } // dándole bvalores a los controles nuevos que mostrarán algunos datos del estudiante seleccionado lblName = new Label(); lblName.Text = "nombre"; lblNameInformation = new Label(); lblNameInformation.Text = found.personalData.name; lblSurname = new Label(); lblSurname.Text = "apellido"; lblInformationSurname = new Label(); lblInformationSurname.Text = found.personalData.surname; lblDni = new Label(); lblDni.Text = "DNI"; lblInformationDni = new Label(); lblInformationDni.Text = found.personalData.dni.ToString(); btnDeleteStudent = new Button(); btnDeleteStudent.Text = "eliminar estudiante"; btnDeleteStudent.Click += new EventHandler(btnDeleteStudent_click); // las filas eran 4, pero no eran nesesarias para la búsqueda, como ahora son necesarias, a continuación se le dan los estilos tlp.RowStyles.Add(new RowStyle(SizeType.Percent, 25f)); tlp.RowStyles.Add(new RowStyle(SizeType.Percent, 25f)); tlp.Controls.Add(lblName, 0, 0); tlp.Controls.Add(lblNameInformation, 1, 0); tlp.Controls.Add(lblSurname, 0, 1); tlp.Controls.Add(lblInformationSurname, 1, 1); tlp.Controls.Add(lblDni, 0, 2); tlp.Controls.Add(lblInformationDni, 1, 2); tlp.Controls.Add(btnCalcel, 0, 3); tlp.Controls.Add(btnDeleteStudent, 1, 3); }