private void CarregarGridView() { var lst = new TipoPagamentoDAO().BuscarPorTexto(txtBusca.Text); gridView.AutoGenerateColumns = false; gridView.DataSource = lst; HabilitarBotoes((gridView.SelectedRows.Count == 1), (gridView.SelectedRows.Count > 1)); gridView.ClearSelection(); }
private void btnEditar_Click(object sender, EventArgs e) { if (gridView.SelectedRows.Count > 0) { var idd = Convert.ToInt32(gridView.SelectedRows[0].Cells[0].Value); var obj = new TipoPagamentoDAO().BuscarPorId(idd); var frm = new FormCadastroPagamento(obj); if (frm.ShowDialog() != DialogResult.OK) { return; } CarregarGridView(); } }