Click here to Skip to main content
15,887,368 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Visual Basic Question?
'Please Modify this program to lock drive C: and D:

Private Sub Command1_Click()
Dim fs As New FileSystemObject
Dim f
Dim strPath As String

strPath = "C:\TestFolder"

Name strPath As strPath & "A"

Set f = fs.GetFolder(strPath & "A")

f.Attributes = -1


End Sub

Private Sub Command2_Click()
Dim fs As New FileSystemObject
Dim f
Dim strPath As String

strPath = "C:\TestFolder"
Set f = fs.GetFolder(strPath & "A")
f.Attributes = 0
Name strPath & "A" As strPath
End Sub
' It has two buttons in a form; lock folder and unlock folder
Please help
Posted
Updated 16-Feb-11 22:02pm
v2
Comments
LittleYellowBird 17-Feb-11 4:03am    
Hi, this loos like a Homework or Assignment question. You will get better responses if you try something and ask for advice if and when if does not work. Have a go yourself and see what happens. :)

1 solution

No! You can do it yourself.

A little basic Google with the search term copy and pasted from your question lead me here in around 30 seconds: http://bitsbyta.blogspot.com/2011/01/lock-and-unlock-folder-cnet.html[^] It is in C# rather than VB, but that's simple enough, the .NET stuff is the same. There is even a translator here: http://www.developerfusion.com/tools/convert/csharp-to-vb/[^] which will convert the code.

Learn to use Google: it could have saved you half an hour...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900