Tag: control

Access List, Microsoft Windows, Security

Modify access control lists on specified files through cmd

Icacls displays or modifies discretionary access control lists (DACLs) on specified files, and applies stored DACLs to files in specified directories.   Parameters Parameter Description <FileName> Specifies the file for which to display DACLs. <Directory> Specifies the directory for which to display DACLs. /t Performs the operation on all specified files in the current directory …

Microsoft Windows

Enable or Disable Control Panel

Disable Control Panel 1. Run cmd as administrator 2. Type: reg add "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer" /v NoControlPanel /t REG_DWORD /d 1 /freg add "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer" /v NoControlPanel /t REG_DWORD /d 1 /f 3. Hit enter 4. Type: shutdown /l /fshutdown /l /f 5. Hit enter to log off     Enable Control Panel 1. Run cmd as administrator …

C#

Cross-thread operation not valid: Control ‘xxxxxx’ accessed from a thread other than the thread it was created on.

To solve this problem that occurs when you are trying to access a form control from another thread, use MethodInvoker. this.Invoke(new MethodInvoker(delegate { Textbox1.AppendText("* test 1 2 3rn"); }));this.Invoke(new MethodInvoker(delegate { Textbox1.AppendText("* test 1 2 3rn"); }));

C#

How to drag information from a DataGridView control

Let’s see how we can drag information from a DataGridView control in C#. We need to handle two events, MouseMove and MouseDown. private Rectangle dragbox; private int DragSelectedRow;   private void dgvc_MouseMove(object sender, MouseEventArgs e) { if ((e.Button & MouseButtons.Left) == MouseButtons.Left) { if (dragbox != Rectangle.Empty && !dragbox.Contains(e.X, e.Y)) { DragDropEffects dropEffect = dgvc.DoDragDrop( …