public void ExcluirVenda() { VendaController vc = new VendaController(); try { selecionado = vc.PesquisarPorID(selecionado.VendaID); } catch (Exception) { MessageBox.Show("Selecione um item para excluir!!"); } if (selecionado == null) { return; } else { vc.ExcluirVenda(selecionado.VendaID); txtID.Text = ""; txtExcluir.Text = ""; dtgMinhasVendas.ItemsSource = ctx.tblVendas.ToList(); lblQuantidadeVendas.Content = ctx.tblVendas.Count(); } }