Toolbox yang diperlukan adalah :
1 textbox
3 button . button 1 = browser , button 2 = lock , button 3 = unlock
1 folderbrowserdialog
Double Click Form anda , lalu dibagian paling atas tempat code/general masukan :
Imports System.Security.AccessControl
Imports System.IO
Double Click Pada Button Browse lalu masukan :
With FolderBrowserDialog1
If .ShowDialog() = DialogResult.OK Then
TextBox1.Text = .SelectedPath
End If
End With
Double Click Pada Button Lock lalu masukan :
Dim fs As FileSystemSecurity = File.GetAccessControl(TextBox1.Text)
fs.AddAccessRule(New FileSystemAccessRule(Environment.UserName, FileSystemRights.FullControl, AccessControlType.Deny))
File.SetAccessControl(TextBox1.Text, fs)
msgbox(“folder telah dikunci”)
Double Click Pada Button Unlock lalu masukan :
Dim fs As FileSystemSecurity = File.GetAccessControl(TextBox1.Text)
fs.RemoveAccessRule(New FileSystemAccessRule(Environment.UserName, FileSystemRights.FullControl, AccessControlType.Deny))
File.SetAccessControl(TextBox1.Text, fs)
msgbox(“folder telah dibuka”)
Jadi syntax code fullnya seperti dibawah ini :
Synra Folder Locker v1.0
|
Imports System.Security.AccessControl
Imports System.IO
Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click
With FolderBrowserDialog1
If .ShowDialog() = DialogResult.OK Then
TextBox1.Text = .SelectedPath
End If
End With
End Sub
Private Sub btnLock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLock.Click
Dim fs As FileSystemSecurity = File.GetAccessControl(TextBox1.Text)
fs.AddAccessRule(New FileSystemAccessRule(Environment.UserName, FileSystemRights.FullControl, AccessControlType.Deny))
File.SetAccessControl(TextBox1.Text, fs)
msgbox(“folder telah dikunci”)
End Sub
Private Sub btnUnLock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUnLock.Click
Dim fs As FileSystemSecurity = File.GetAccessControl(TextBox1.Text)
fs.RemoveAccessRule(New FileSystemAccessRule(Environment.UserName, FileSystemRights.FullControl, AccessControlType.Deny))
File.SetAccessControl(TextBox1.Text, fs)
msgbox(“folder telah dibuka”)
End Sub
|
mas dari penulisan diatas bnyak yang salah
BalasHapusmohon diperbaiki lgi
~Trims~
mas itu sintak app.configNya itu dari mana mas
Hapus