Files hiding application

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
1 post Page 1 of 1
Contributors
User avatar
DarkyKnife
Top Poster
Top Poster
Posts: 109
Joined: Thu Apr 29, 2010 4:59 pm

Files hiding application
DarkyKnife
Hello, i will try to explain how to hide files using VB. Heres what you need to add:
5 buttons,
2 listboxes
1 textbox
1 openfiledialog
1 savefiledialog
1 folderbrowsingdialog

Now rename whatever button to "hide file", double click it and paste this code:
Code: Select all
 Try
            OpenFileDialog1.ShowDialog()
            For Each file In OpenFileDialog1.FileNames
                ListBox1.Items.Add(file)
                ListBox2.Items.Add(System.IO.Path.GetFileName(file))
            Next
            Dim ToHideDir As New System.IO.DirectoryInfo(OpenFileDialog1.FileName)
            ToHideDir.Attributes = IO.FileAttributes.Hidden
            MsgBox("File has been hidded!", MsgBoxStyle.Information, "Hider")
        Catch ex As Exception
        End Try 
This will hide your selected file and adds info about it in listbox.

Rename other button to "hide folder" and add this code:
Code: Select all
 Try
            FolderBrowserDialog1.ShowDialog()
            ListBox1.Items.Add(FolderBrowserDialog1.SelectedPath.Trim())
            ListBox2.Items.Add(System.IO.Path.GetFileName(FolderBrowserDialog1.SelectedPath.Trim))

            Dim ToHideDir As New System.IO.DirectoryInfo(FolderBrowserDialog1.SelectedPath.Trim)
            ToHideDir.Attributes = IO.FileAttributes.Hidden
            MsgBox("File has been hidded!", MsgBoxStyle.Information, "Hider")
        Catch ex As Exception
        End Try
  
This also hides your folder and adds folder name to listbox.

Now rename other button to "dehide" or something and add this code:
Code: Select all
 Try
            Dim ToHide As New System.IO.DirectoryInfo(ListBox1.SelectedItem)
            ToHide.Attributes = IO.FileAttributes.Normal
            ListBox1.Items.Remove(ListBox1.SelectedItem)
            ListBox2.Items.Remove(ListBox2.SelectedItem)
            MsgBox("File restored!", MsgBoxStyle.Information, "Hider")
        Catch ex As Exception
        End Try
  
This will restores your selected item in listbox.

Rename other button to "dehide from url" and add this code:
Code: Select all
 Try
            Dim ToHideDir As New System.IO.DirectoryInfo(TextBox1.Text)
            ToHideDir.Attributes = IO.FileAttributes.Normal
            MsgBox("File restored!", MsgBoxStyle.Information, "Hider")
        Catch ex As Exception
        End Try  
This restores your hidden file by writing url in textbox.

And the last button. Make it "save list" and add code:
Code: Select all
 Try
            SaveFileDialog1.ShowDialog()
            Dim w As New IO.StreamWriter(SaveFileDialog1.FileName)
            Dim i As Integer
            For i = 0 To ListBox1.Items.Count - 1
                w.WriteLine(ListBox1.Items.Item(i))
            Next
            w.Close()
        Catch ex As Exception
        End Try 
It will make text file with your hidden files url's, so you will never forget what have you been hid.

Make the listbox1 visible = false or hide off the program borders and make listbox2 visible.
Make listbox2 event _click and add this code:
Code: Select all
 Try
            ListBox1.SelectedIndex = ListBox2.SelectedIndex
        Catch ex As Exception
        End Try  
Add another listbox2 event _SelectedIndexChanged and add this code:
Code: Select all
 
On Error Resume Next
        ListBox1.SelectedIndex = ListBox1.SelectedIndex
 
And it should be working. Sorry if something similar was there. Also you can download the whole project here.
Visit my Youtube chanel
1 post Page 1 of 1
Return to “Tutorials”