title: Numbering each row in a ListView (C#)
body: <p>REVISED: I have a Windows Forms Application and have added a ListView. I am able to add items to my list view, but I am wanting to number each row that has an item. I want those numbers to appear in column 2.</p>
  
  <pre><code>        if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
          {
              int initialID = 2;
  
              //Change button text.
              button4.Text = ("Clear/Add Fonts");
  
              //For each string in the open file dialog array.
              foreach (string fontFileName in ofd.SafeFileNames)
              {
                  //Add a line in the list view for each selected file. Don't allow for the same file to appear twice.
                  if (listView1.FindItemWithText(fontFileName) == null)
                  {
                      for (int i = 0; i &lt; initialID; i++)
                          listView1.Items.Add(fontFileName).SubItems.Add((i).ToString());
                  }
              }
          }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/izLV4.png" alt="enter image description here"></p>
  
  <p>Sorry of the change was somewhat dramatic after the revision. I now have the numbers appearing under the Font ID, but now I can't seem to get it to increment. I think I'm very close. </p>
  
  <p><strong><em>Answer:</em></strong>
  Here is how I implemented the suggestions by Cyral:</p>
  
  <pre><code>if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
              {
                  int initialID = 1;
                  int count = initialID;
  
                  //Change button text.
                  button4.Text = ("Clear/Add Fonts");
  
                  //For each string in the open file dialog array.
                  foreach (string fontFileName in ofd.SafeFileNames)
                  {
                      //Add a line in the list view for each selected file. Don't allow for the same file to appear twice.
                      if (listView1.FindItemWithText(fontFileName) == null)
                      {
                              listView1.Items.Add(fontFileName).SubItems.Add(count++.ToString());
                      }
                  }
              }
              else
  </code></pre>