title: StreamWrite unable to write textbox.Text into a .txt file (Vb.net)
body: <p>I've been searching and trying multiple solutions for this problem i've ran into. I'm trying to save the results of a textbox as a line of text in a .txt file.</p>
  
  <p>Here is the code before, when, and after i try to call upon StreamWriter to do this.</p>
  
  <pre><code>    If inttAnswer = vbOK Then
                  totalprofiles.Write(filename &amp; vbNewLine) '*this is not working*
                  txtProfileName.Text = ""
                  Me.Hide()
                  Profiles.StartPosition = FormStartPosition.Manual
                  Profiles.Location = Me.Location
                  Profiles.Show()
      End If
  </code></pre>
  
  <p>Here are any declarations that i'm using for this section of code, which is part of a block of code that occurs upon a button press:</p>
  
  <pre><code>    Dim totalprofiles2 As String = "C:\SameSens\Profiles\TotalProfiles.txt"
      Dim totalprofiles As New System.IO.StreamWriter(totalprofiles2, True)
  
      Dim inttAnswer As Integer
      Dim filename As String = txtProfileName.Text
  </code></pre>
  
  <p>Thanks for your help.
  If this is not possible, perhaps you could suggest a different/better alternative to being able to populate a ComboBox with the text in txtProfileName.Text permanently as an item once this particular button is pressed. I thought populating the ComboBox with a .txt files contents would be the easiest and most practical way, but its proving more difficult then I thought.</p>