Beispiel #1
0
 private void txtNome_KeyPress(object sender, KeyPressEventArgs e)
 {
     if ((Keys)e.KeyChar == Keys.Enter)
     {
         if (txtNome.Text == "")
         {
             MessageBox.Show("Campo Descrição não pode estar vazio!");
         }
         else
         {
             if (statusForm == eStatusForm.insert)
             {
                 try
                 {
                     clsSemestres semestre = new clsSemestres(txtNome.Text);
                     clsSemestres.inserir(semestre.descricao);
                 }
                 catch (Exception)
                 {
                     MessageBox.Show(MessageBoxIcon.Error + "Não foi possivel inserir!");
                 }
             }
             if (statusForm == eStatusForm.update)
             {
                 string _descricao;
                 try
                 {
                     _descricao = txtNome.Text;
                     clsSemestres.editar(codAnt, _descricao);
                 }
                 catch (Exception)
                 {
                     MessageBox.Show(MessageBoxIcon.Error + "Não foi possivel editar!");
                 }
             }
             acaoSemestre("", false);
             carregarDataGrid();
         }
         e.Handled = true;
     }
 }
 private void txtNome_KeyPress(object sender, KeyPressEventArgs e)
 {
     if ((Keys)e.KeyChar == Keys.Enter)
     {
         if (txtNome.Text == "")
             MessageBox.Show("Campo Descrição não pode estar vazio!");
         else
         {
             if (statusForm == eStatusForm.insert)
             {
                 try
                 {
                     clsSemestres semestre = new clsSemestres(txtNome.Text);
                     clsSemestres.inserir(semestre.descricao);
                 }
                 catch (Exception)
                 {
                     MessageBox.Show(MessageBoxIcon.Error + "Não foi possivel inserir!");
                 }
             }
             if (statusForm == eStatusForm.update)
             {
                 string _descricao;
                 try
                 {
                     _descricao = txtNome.Text;
                     clsSemestres.editar(codAnt, _descricao);
                 }
                 catch (Exception)
                 {
                     MessageBox.Show(MessageBoxIcon.Error + "Não foi possivel editar!");
                 }
             }
             acaoSemestre("", false);
             carregarDataGrid();
         }
         e.Handled = true;
     }
 }