コード例 #1
0
        private void gridContacts_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewLinkCell cell = (DataGridViewLinkCell)gridContacts.Rows[e.RowIndex].Cells[e.ColumnIndex];

            if (cell.Value.ToString() == "Editar")
            {
                contactoDetalle contactoDetalle = new contactoDetalle();

                contactoDetalle.CargarContacto(new Contacto
                {
                    Id        = int.Parse(gridContacts.Rows[e.RowIndex].Cells[2].Value.ToString()),
                    Nombre    = gridContacts.Rows[e.RowIndex].Cells[3].Value.ToString(),
                    Apellido  = gridContacts.Rows[e.RowIndex].Cells[4].Value.ToString(),
                    Telefono  = gridContacts.Rows[e.RowIndex].Cells[5].Value.ToString(),
                    Direccion = gridContacts.Rows[e.RowIndex].Cells[6].Value.ToString(),
                });

                contactoDetalle.ShowDialog(this);
            }
            else if (cell.Value.ToString() == "Eliminar")
            {
                EliminarContacto(int.Parse(gridContacts.Rows[e.RowIndex].Cells[2].Value.ToString()));
                CargarContactos();
            }
        }
コード例 #2
0
        private void AbrirContactoDetalle()
        {
            contactoDetalle contactoDetalle = new contactoDetalle();

            contactoDetalle.ShowDialog(this);
        }