title: Populate files into a listbox from a folder in C# windows forms
body: <p>I'm a newbie in C# and I have 2 Listboxes l-->istBox1 and listBox2 and I want to load files from folder into these listboxes.
  I tried like this :
  <code>listBox1:</code></p>
  
  <pre><code>private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
          {
              DirectoryInfo dinfo = new DirectoryInfo(@"C:\TestLoadFiles");
              FileInfo[] Files = dinfo.GetFiles("*.rtdl");
              foreach (FileInfo file in Files)
              {
                  listbox1.Items.Add(file.Name);
              }
  
          }
  </code></pre>
  
  <p><code>listBox2:</code></p>
  
  <pre><code>private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
          {
              DirectoryInfo dinfo = new DirectoryInfo(@"C:\TestLoadFiles");
              FileInfo[] Files = dinfo.GetFiles("*.dlz");
              foreach (FileInfo file in Files)
              {
                  listbox2.Items.Add(file.Name);
              }
          }
  </code></pre>
  
  <p>when i run the form, the files from the folder is not displaying???</p>