Cara membuat aplikasi pengunci folder (folder loker) di visual studio
1. desing form seperti ini
1. desing form seperti ini
2. Listing Program
Imports System.Security.AccessControl
Imports System.IO
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
With FolderBrowserDialog1
If .ShowDialog() = Windows.Forms.DialogResult.OK Then
TextBox1.Text = .SelectedPath
End If
End With
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.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("Sukses , Folder Telah Di Kunci")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.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("Sukses , Foder Bisa Dibuka Kembali")
End Sub
Private Sub SearchFolderToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchFolderToolStripMenuItem.Click
With FolderBrowserDialog1
If .ShowDialog() = Windows.Forms.DialogResult.OK Then
TextBox1.Text = .SelectedPath
End If
End With
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub
End Class
Imports System.IO
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
With FolderBrowserDialog1
If .ShowDialog() = Windows.Forms.DialogResult.OK Then
TextBox1.Text = .SelectedPath
End If
End With
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.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("Sukses , Folder Telah Di Kunci")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.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("Sukses , Foder Bisa Dibuka Kembali")
End Sub
Private Sub SearchFolderToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchFolderToolStripMenuItem.Click
With FolderBrowserDialog1
If .ShowDialog() = Windows.Forms.DialogResult.OK Then
TextBox1.Text = .SelectedPath
End If
End With
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub
End Class
0 Response to "Cara membuat aplikasi pengunci folder (folder loker) di visual studio"
Post a Comment