locked
Create a hide Folder RRS feed

  • Question

  • How do you create a hide folder??

    I know how to create folder but how if I want to hide it?
    Friday, June 26, 2009 7:18 AM

Answers

  • Hi MiCzZZ,

    based on this link: http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/44da4f00-183b-43b1-ad68-99639e543ca2/

    you can use for example:

    Dim di As DirectoryInfo = Directory.CreateDirectory("C:\hidden")
    
    di.Attributes = FileAttributes.Hidden
    

    Mark the thread as answered if the answer helps you. This helps others who have the same problem !
    • Proposed as answer by Omie Friday, June 26, 2009 7:45 AM
    • Marked as answer by MiCzZz Friday, June 26, 2009 8:07 AM
    Friday, June 26, 2009 7:31 AM
  • Public Class Form1
        ' hide folder
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            IO.File.SetAttributes("C:\Users\trujade\Desktop\my msdn", IO.FileAttributes.Hidden)
        End Sub
    
        ' unhide folder
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            IO.File.SetAttributes("C:\Users\trujade\Desktop\my msdn", IO.FileAttributes.Normal)
        End Sub
    End Class

    found the code online and had to edit it some, but it seems to work.. nice question. ;o)
    guess i finally learned something today as well, how to hide/unhide folders.

    trujade


    help out microsoft for helping you.. test run 7
    • Edited by •.trujade.• Friday, June 26, 2009 7:51 AM cleaned up the code.
    • Marked as answer by MiCzZz Friday, June 26, 2009 8:07 AM
    Friday, June 26, 2009 7:42 AM

All replies

  • Hi MiCzZZ,

    based on this link: http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/44da4f00-183b-43b1-ad68-99639e543ca2/

    you can use for example:

    Dim di As DirectoryInfo = Directory.CreateDirectory("C:\hidden")
    
    di.Attributes = FileAttributes.Hidden
    

    Mark the thread as answered if the answer helps you. This helps others who have the same problem !
    • Proposed as answer by Omie Friday, June 26, 2009 7:45 AM
    • Marked as answer by MiCzZz Friday, June 26, 2009 8:07 AM
    Friday, June 26, 2009 7:31 AM
  • Public Class Form1
        ' hide folder
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            IO.File.SetAttributes("C:\Users\trujade\Desktop\my msdn", IO.FileAttributes.Hidden)
        End Sub
    
        ' unhide folder
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            IO.File.SetAttributes("C:\Users\trujade\Desktop\my msdn", IO.FileAttributes.Normal)
        End Sub
    End Class

    found the code online and had to edit it some, but it seems to work.. nice question. ;o)
    guess i finally learned something today as well, how to hide/unhide folders.

    trujade


    help out microsoft for helping you.. test run 7
    • Edited by •.trujade.• Friday, June 26, 2009 7:51 AM cleaned up the code.
    • Marked as answer by MiCzZz Friday, June 26, 2009 8:07 AM
    Friday, June 26, 2009 7:42 AM
  • I have another question.. What is the code on how to open the folder?
    Friday, June 26, 2009 8:18 AM
  • I have another question.. What is the code on how to open the folder?
    Friday, June 26, 2009 8:19 AM
  • I suppose you want to open folder in Explorer window.
    If so, then you could use,

    Process.Start("FolderPath C:\Temp for example")
    Thanks

    - Omie
    Someone makes my heart skip a clock cycle !
    Friday, June 26, 2009 8:29 AM