Пример #1
0
        private void btnEditar_Click(object sender, System.EventArgs e)
        {
            if (tblContatos.Rows.Count <= 0)
            {
                return;
            }

            try
            {
                if (tblContatos.CurrentRow.Cells["ID"].Value == null)
                {
                    MessageBox.Show("Selecione um contato para editar.");
                    return;
                }

                var idContato = int.Parse(tblContatos.CurrentRow.Cells["ID"].Value.ToString());
                frmIncluirContato frmIncluirContato = new frmIncluirContato(idContato);
                frmIncluirContato.StartPosition = FormStartPosition.CenterParent;
                frmIncluirContato.ShowDialog();
                PreencheTabelas();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void btnSalvar_Click(object sender, System.EventArgs e)
        {
            frmIncluirContato frmIncluirContato = new frmIncluirContato();

            frmIncluirContato.StartPosition = FormStartPosition.CenterParent;
            frmIncluirContato.ShowDialog();
            PreencheTabelas();
        }