private void btnAlterar_Click(object sender, EventArgs e) { try { if (gvServico.CurrentRow != null) { frmCadastroServico frmCadServico = new frmCadastroServico(); var cliRow = gvServico.CurrentRow.DataBoundItem as DataRowView; var codigo = cliRow["codigo"]; frmCadServico.Carregar(codigo); if (frmCadServico.ShowDialog() == DialogResult.OK) { gvServico.DataSource = CtrlServico.ListarTodos(); } } else { MessageBox.Show("Selecione o serviço que deseja alterar!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnNovo_Click(object sender, EventArgs e) { frmCadastroServico frmCadServico = new frmCadastroServico(); if (frmCadServico.ShowDialog() == DialogResult.OK) { gvServico.DataSource = CtrlServico.ListarTodos(); } }