private void btnAtualizarAlunos_Click(object sender, EventArgs e) { AlunoOp aluop = new AlunoOp(); List <Aluno> alus = new List <Aluno>(); try { alus = aluop.ListarAlunos(); dgvListarAlunos.ForeColor = Color.Black; dgvListarAlunos.DataSource = alus; dgvListarAlunos.Columns[5].Visible = false; dgvListarAlunos.ClearSelection(); } catch (Exception ex) { MessageBox.Show($"Um erro ocorreu.\nMensagem: {ex.Message}", "Atenção"); } }
public ControleListarAlunos() { InitializeComponent(); AlunoOp aluop = new AlunoOp(); List <Aluno> alus = new List <Aluno>(); try { alus = aluop.ListarAlunos(); dgvListarAlunos.ForeColor = Color.Black; dgvListarAlunos.DataSource = alus; dgvListarAlunos.Columns[5].Visible = false; dgvListarAlunos.ClearSelection(); } catch (Exception ex) { MessageBox.Show($"Um erro ocorreu.\nMensagem: {ex.Message}", "Atenção"); } }