Sunday, March 25, 2012

How to: Close Windows form while doing CreateHandle()

The error Value Close() cannot be called while doing CreateHandle() usually happens when we try to close the form in the constructor or Load event.
For example,

the following code gives the error:

private void frmCustomer_Load(object sender, EventArgs e)
{
if (!Valid())
this.Close;
}

The Solution:

Thursday, March 22, 2012

How To: Enable Hidden attribute in folder options

To enable to change folder/file hidden attribute in properties option again:   

1. Goto command prompt

  • Click start -> run
  • Type cmd and press enter

2. Change your working directory to driver letter of USB drive, for example type H:

  • In the command window that opens type "cd [drivename]" and press enter
  • Type "dir" and press enter

3. Type the command "attrib /s /d -s -h [file/folder name]" and press enter or type

Where,
-r will clear the Read Only Attribute
-s will clear the System file Attribute
-h will clear the Hidden file Attribute
/s will apply above command to all files in working directory
/d will apply above command to all folders in working directory
[foldername] is the name of the folder without the square brackets)