Пример #1
0
        private void btnAdicionar_Click(object sender, EventArgs e)
        {
            frmIncluirAlterarContato form = new frmIncluirAlterarContato();

            form.ShowDialog();
            CarregarDataGridView();
        }
 private void btnAlterar_Click(object sender, EventArgs e)
 {
     Contato contatoEditar = new Contato
     {
         Id = (int)dgvAgenda.CurrentRow.Cells[0].Value,
         Nome = dgvAgenda.CurrentRow.Cells[1].Value.ToString(),
         Email = dgvAgenda.CurrentRow.Cells[2].Value.ToString(),
         Telefone = (int)dgvAgenda.CurrentRow.Cells[3].Value
     };
     frmIncluirAlterarContato form = new frmIncluirAlterarContato(contatoEditar);
     form.ShowDialog();
     CarregarDataGridView();
 }
Пример #3
0
        private void btnAlterar_Click(object sender, EventArgs e)
        {
            Contato contato = new Contato
            {
                Id       = (int)dgvAgenda.CurrentRow.Cells[0].Value,
                Nome     = dgvAgenda.CurrentRow.Cells[1].Value.ToString(),
                Email    = dgvAgenda.CurrentRow.Cells[2].Value.ToString(),
                Telefone = (int)dgvAgenda.CurrentRow.Cells[3].Value
            };
            frmIncluirAlterarContato form = new frmIncluirAlterarContato(contato);

            form.ShowDialog();
            CarregarDataGridView();
        }
 private void btnAdicionar_Click(object sender, EventArgs e)
 {
     frmIncluirAlterarContato form = new frmIncluirAlterarContato();
     form.ShowDialog(); //formulário ficará em foco e não podera voltar enquanto não clicar
     CarregarDataGridView();
 }