title: Write first and second column rows in listview inside each row in a text file
body: <p>I'm using <code>WinForms</code>. In my form I have a <code>listview</code> and a button. When I click on the button the program writes all of the items in the <code>listview</code> into a text file. The problem is that I want the first and second column to be in one line.</p>
  
  <p>Here is my code so far that i use to write to the text file:</p>
  
  <pre><code>            using (StreamWriter sw = File.CreateText(DirectoryPath))
              {
                  foreach (ListViewItem item in listView1.Items)
                  {
                      sw.WriteLine(item.Text);
                      for (int i = 1; i &lt; item.SubItems.Count; i++)
                      {
                          sw.WriteLine(item.SubItems[i].Text);
                      }
                  }
               }
  </code></pre>
  
  <p><strong>My ListView</strong></p>
  
  <p><a href="https://i.stack.imgur.com/0bBAL.png" rel="nofollow"><img src="https://i.stack.imgur.com/0bBAL.png" alt="My list View"></a></p>
  
  <p><strong>Problem output text file</strong></p>
  
  <p><a href="https://i.stack.imgur.com/lcWaU.png" rel="nofollow"><img src="https://i.stack.imgur.com/lcWaU.png" alt="Problem Text file"></a></p>
  
  <p><strong>How I want the text file to display</strong></p>
  
  <p><a href="https://i.stack.imgur.com/JoxNc.png" rel="nofollow"><img src="https://i.stack.imgur.com/JoxNc.png" alt="Goal"></a></p>