title: how to Write Content into textfile in vb.net
body: <p>I Created VALIDCCC.TXT and I need to write some content into this text file, content as shown below</p>
  
  <p>Content : </p>
  
  <pre><code>00   A0
  00   A1
  00   A2
  10   A0
  10   A1
  </code></pre>
  
  <p>My Code as Follows :</p>
  
  <pre><code>filepath = filepath + "\" + strsubmenu + "\"
  
  If (Not System.IO.Directory.Exists(filepath)) Then
      System.IO.Directory.CreateDirectory(filepath)
  End If
  
  filepath = filepath + "MATRIX\"
  If (Not System.IO.Directory.Exists(filepath)) Then
      System.IO.Directory.CreateDirectory(filepath) 
  End If
  
  filepath = filepath + "VALIDCCC.TXT"
  If (Not System.IO.Directory.Exists(filepath)) Then
      File.Create(filepath)
  End If
  
  File.WriteAllText(filepath, String.Empty)
  Dim objWriter As New System.IO.StreamWriter(filepath, True)
  
  For Each Customeritem As ListItem In CustomerCodeDVListBox.Items
  
     For Each CCCitem As ListItem In CCCListBox.Items 
         objWriter.WriteLine(Customeritem.ToString() + Space(4) + CCCitem.ToString()) 
     Next
  Next 
  </code></pre>
  
  <p>I have 2 listboxes combination of this listbox seleted values should write into Textfile.
  Before writing content if VALIDCCC.TXT exists I need to clear the content or overwrite with New Content...</p>