Latest: Download Free Desktop Wallpapers of Chef Loony! | Series: AuthorRank? | Download MBT eBooks!

Cara Membuat Software Pengunci Folder Dengan VB.Net

2 comments
Pertama anda harus membuat Form seperti gambar dibawah ini :

 
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


2 komentar:

  1. mas dari penulisan diatas bnyak yang salah
    mohon diperbaiki lgi
    ~Trims~

    BalasHapus
    Balasan
    1. mas itu sintak app.configNya itu dari mana mas

      Hapus

  • MBT Icons and buttons

    Icons and Buttons

    Our resources have been successfully downloaded over 10K times and found almost every where. Get yours!

  • choosing webhost for a blog

    Why HostGator?

    Learn Why we chose HostGator as our Web Host and find discount coupons to kick start your blog today!

  • SEO Settings for blogger

    ALL IN ONE SEO PACK 2012

    Learn every single SEO tip that will boost your blog's ranking and organic traffic. We got them all!

  • Blogger widgets and plugins

    Visit MBT's Blogger LAB

    Why not take a tour of all great Blogger widgets published so far? You Name it we have it!

  • become a six figure blogger!

    Become a SIX FIGURE BLOGGER

    Learn what it takes to become a successful entrepreneur and build a living online!