private void button1_Click_2(object sender, EventArgs e) { try { Carro Carro = new Carro(); Carro.Placa = txtPlaca.Text; Carro = CarroDAO.obterPlaca(Carro); if (Carro != null) { CarroDAO.Excluir(Carro); MessageBox.Show("Carro Excluido", "Excluido"); this.Close(); } else { MessageBox.Show("Carro inexistente", "Erro"); } } catch { MessageBox.Show("Carro inexistente", "Erro"); } }