title: Loading data from List Box to Picture Box
body: <p>:) </p>
  
  <p>I'm having a slight issue where I'm trying to view picture files from my computer on a picture box when I select them. The files appear in the list box but won't appear on the picture box when selected</p>
  
  <p>This is my code</p>
  
  <pre><code>using System;                                                                   /    {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void getPictures_Click(object sender, EventArgs e)
          {
              string[] filters = { "*.jpg", "*.jpeg", "*.png", "*.gif", "*.bmp" };
  
              var directory = new DirectoryInfo(@"C:\Pictures");
  
              var files = new List&lt;FileInfo&gt;();
  
              foreach (var filter in filters)
              {
                  var results = directory.GetFiles(filter, SearchOption.AllDirectories);
                  files.AddRange(results);
              }
  
              foreach (var file in files)
              {
                  lbName.Items.Add(file.Name);
              }
              var dialog = new FolderBrowserDialog();
              var result = dialog.ShowDialog();
  
              if (result == DialogResult.OK)
              {
                  string path = dialog.SelectedPath;
                  lblText.Text = path;
              }
          }
  
          private void lbName_SelectedIndexChanged(object sender, EventArgs e)
          {
              pictureBox1.Image = Image.FromFile(((FileInfo)lbName.SelectedItem).FullName);
          }
          private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
          {
  
              pictureBox1.Image = Image.FromFile(((FileInfo)lbName.SelectedItem).FullName);
          }
      }
  }
  </code></pre>
  
  <p>I've tried a number of ways but this is the current code I'm working with. Anyone see where I'm going wrong? I'm still new to C# and don't know all the syntax off by heart but I'm getting there. Any help would be more than appreciated. </p>
  
  <p>Milly</p>