title: Saving data with a file name of my choice
body: <p>Very kindly, an intelligent member of stack overflow showed me how to loop with 'Do Until' and generate messages boxes to enable a user to save a file or rename one, if it already exists.  However, I'm still hitting a wall.  I can't save the ListView data in my for loop, with the file name I have chosen in the Input Box (see code below). Its like I have two separate pieces of code because rtb is saving data in a Rich Text File called Test.txt and saveFile has nothing to do with this! Please help</p>
  
  <p>Code</p>
  
  <pre><code> Dim fileSaved As Boolean
  
      Do Until fileSaved
          Dim saveFile As String = InputBox("Enter a file name to save this message")
          If saveFile = "" Then Exit Sub
          Dim docs As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments
          Dim filePath As String = IO.Path.Combine(docs, "Visual Studio 2013\Projects", saveFile &amp; ".txt")
  
              fileSaved = True
              If My.Computer.FileSystem.FileExists(filePath) Then
                  Dim msg As String = "File Already Exists. Do You Wish To Overwrite it?"
                  Dim style As MsgBoxStyle = MsgBoxStyle.YesNo Or MsgBoxStyle.DefaultButton2 Or MsgBoxStyle.Critical
                  fileSaved = (MsgBox(msg, style, "Warning") = MsgBoxResult.Yes)
              End If
          Loop
  
          'THIS NEXT bit of code saves content to Test.txt NOT saveFile as desired!
  
          Dim rtb As New RichTextBox
          rtb.AppendText("Generation, Num Of Juveniles, Num of Adults, Num of Semiles, Total" &amp; vbNewLine)
          For Each saveitem As ListViewItem In ListView1.Items
              rtb.AppendText(
                             saveitem.Text &amp; ", " &amp;
                             saveitem.SubItems(1).Text &amp; ", " &amp;
                             saveitem.SubItems(2).Text &amp; ", " &amp;
                             saveitem.SubItems(3).Text &amp; ", " &amp;
                             saveitem.SubItems(4).Text &amp; vbNewLine)
          Next
          rtb.SaveFile("C:\Users\SMITH\Documents\Visual Studio 2013\Projects\Test.txt", _
          RichTextBoxStreamType.PlainText)
  </code></pre>