title: How do I create, hide and unhide a folder using C#?
body: <pre><code>    private void button1_Click(object sender, EventArgs e)
      {
  
          if (!Directory.Exists("Test"))
          {
              DirectoryInfo dir = Directory.CreateDirectory("Test");
              dir.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
  
          }
          else
          {
              var dir = new DirectoryInfo("Test");
              dir.Attributes |= FileAttributes.Normal;
          }
  
          String password = "123";
  
          if ((textBox1.Text == password))
          {
              this.Hide();
              Form2 f2 = new Form2();
              f2.ShowDialog();
  
              var dir = new DirectoryInfo("Test");
              dir.Attributes |= FileAttributes.Normal;         
          }
          else
              MessageBox.Show("Incorrect Password or Username", "Problem");
  </code></pre>
  
  <p>So, the visual side looks like this: <a href="http://prntscr.com/7rj9hc" rel="nofollow noreferrer">http://prntscr.com/7rj9hc</a>
  So you type in the password "123" and then click unlock which should in theory make the folder "test" unhide and you can put stuff in. Then a second form comes along with a button "Lock" which makes the folder hide again and closes the program so you can then open and close the folder to add more stuff and take some out. So how would i go about doing this? Any solutions you have will be much appreciated and please (if you have time) explain what it is each part is doing. Please in your solution can you show me how to hide the folder again</p>