Exemplo n.º 1
0
        private void gridContactos_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewLinkCell cell = (DataGridViewLinkCell)gridContactos.Rows[e.RowIndex].Cells[e.ColumnIndex];

            if (cell.Value.ToString() == "Editar")
            {
                DatosContacto datosContacto = new DatosContacto();
                datosContacto.LoadContacto(new Agenda
                {
                    Id        = int.Parse(gridContactos.Rows[e.RowIndex].Cells[0].Value.ToString()),
                    Nombre    = gridContactos.Rows[e.RowIndex].Cells[1].Value.ToString(),
                    Apellido  = gridContactos.Rows[e.RowIndex].Cells[2].Value.ToString(),
                    Telefono  = gridContactos.Rows[e.RowIndex].Cells[3].Value.ToString(),
                    Direccion = gridContactos.Rows[e.RowIndex].Cells[4].Value.ToString(),
                });
                datosContacto.ShowDialog(this);
            }
            else if (cell.Value.ToString() == "Eliminar")
            {
                EliminarContacto(int.Parse(gridContactos.Rows[e.RowIndex].Cells[0].Value.ToString()));
                PopulateContactos();
            }
        }
Exemplo n.º 2
0
        private void OpenDatosContactoDialog()
        {
            DatosContacto datosContacto = new DatosContacto();

            datosContacto.ShowDialog(this);
        }