title: How to write a text file to a desktop sub-folder in vb.net
body: <p>Please I want to write a text file to a sub-folder I have created within a folder on the desktop i.e.</p>
  
  <p>Desktop Folder > Sub-folder > Text file</p>
  
  <p>The code I came up with is shown below. I have created the sub-folder within the parent desktop folder, but cannot locate this sub-folder to write and save the text file. Please I would appreciate any suggestions. I am using Visual Basic 2010 Express. Thank you in advance.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  
  ‘Check if a sub-folder with the title specified in Textbox1 does not exist in desktop folder      titled Family
  
          If (Not System.IO.Directory.Exists("C:\Users\" &amp; Environ("username") &amp; "\Desktop\Family\" &amp; TextBox1.Text)) Then
  
     ‘Create a sub-folder within desktop folder titled Family with the title specified in Textbox1
  
           System.IO.Directory.CreateDirectory("C:\Users\" &amp; Environ("username") &amp; "\Desktop\Family\" &amp; TextBox1.Text)
          End If
  
  Dim fileTXT As New IO.StreamWriter("C:\Users\" &amp; Environ("username") &amp; "\Desktop\Family\" &amp; TextBox1.Text &amp; TextBox1.Text &amp; ".TXT")
  
          fileTXT.Write(TextBox2.Text)
          fileTXT.WriteLine("")
          Close()
  
      End Sub</code></pre>
  </div>
  </div>
  </p>