示例#1
0
 private void textBox1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         try
         {
             AlunosDAO dao        = new AlunosDAO();
             AlunoEnt  aluno      = dao.SelectPorId(textBox1.Text.ToInt());
             Form      formulario = new frmFormulario()
             {
                 FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable
             };
             formulario.Controls.Add(new frmAluno(aluno, Tranz.Alterar));
             formulario.Size = formulario.Controls[0].Size;
             formulario.ShowDialog();
             this.Close();
         }
         catch (Exception erro)
         {
             MessageBox.Show(erro.Message);
         }
     }
 }