title: Listbox in C# has an empty line when an item is added?
body: <p>So, I had to use a Listbox for a small C# project, and ran into a problem. The Listbox displays file-names, and an item is added every-time someone uses a File Dialog box to add in the item. The problem is when the very first file is added, nothing shows up. but when a second file is added, its an empty line.</p>
  
  <p>Here is a picture to illustrate the problem:</p>
  
  <p><img src="https://i.stack.imgur.com/WkpN3.png" alt="The problem with the listbox"></p>
  
  <p>Now, how do I get rid of the first blank line and properly add in the filename to the top of the listbox?</p>
  
  <p>Here is the code that I am using to add to the listbox.</p>
  
  <pre><code>// Set a global variable to hold all the selected files result
  List&lt;String&gt; fullFileName;
  
  private void addBtn_Click(object sender, EventArgs e)
  {
      DialogResult result = fileDialog.ShowDialog(); // Show the dialog.
      if (result == DialogResult.OK) // Test result.
      {
         // put the selected result in the global variables
         fullFileName = new List&lt;String&gt;(fileDialog.FileNames);
         // add just the names to the listbox
         foreach (string fileName in fullFileName)
         {
             dllBox.Items.Add(fileName.Substring(fileName.LastIndexOf(@"\") + 1));
         }
     }
  }
  </code></pre>
  
  <p>And here is the properties for fileDialog:</p>
  
  <p><img src="https://i.stack.imgur.com/amO3t.png" alt="FileDialog"></p>
  
  <p>As well as the dllBox properties</p>
  
  <p><img src="https://i.stack.imgur.com/JqaCN.png" alt="1a1s"> <img src="https://i.stack.imgur.com/PGeMN.png" alt="21"></p>