I want to Hide/Unhide a File Folder with one button click.
Any ideas?
Maybe later I want to password protect folder/file access also.
Printable View
I want to Hide/Unhide a File Folder with one button click.
Any ideas?
Maybe later I want to password protect folder/file access also.
You can just manipulate the files attributes to hidden.
I like to protect my folders by running a program I wrote. The program watches the names of open windows and when it finds a match with one I have selected, it close it. i.e. I tell my program to watch for "new folder". When "new folder" or any program named that is opened, my program closes that window.
There is a problem with using the method mentioned above. If you tell the program to watch for "new folder", then anyone can rename the folder to "new folder2" and then open it. In order to safeguard against this, you must write a function that compares the names and finds any close matches.
Dim Dir = "C:\A\"
'Hides All The Files (Not SubFolders)
Dim DirInfo As New IO.DirectoryInfo(Dir)
Dim Files As IO.FileInfo() = DirInfo.GetFiles
Dim FileName As IO.FileInfo
For Each FileName In Files
SetAttr(Dir & FileName.ToString, FileAttribute.Hidden)
Next
'Hides The Folder
SetAttr(Dir, FileAttribute.Hidden)
'Visual Basic 2008 Tested
this is a vb6 forumQuote:
'Visual Basic 2008 Tested
vb Code:
SetAttr "c:\temp\abc\", vbHidden
My bad, just trying to help
No offense, but if it had taken me 9 years to get this I would've found a new line of work :)
Or just gone to a real language like C#
(flames begin) lol
I never pay attention to the dates because people take a look at these all time. Its a great thing to leave useful code on the internet for other people to copy. Especially if they understand the code and better themselves as a programmer
Even if I post it in the wrong category :)