title: Using a combobox dropdown list with PictureBox
body: <p>I'm trying to display a picture in a picturebox using a combobox dropdownlist, populated with genres of books; Networking, Programming, Web.  When the user selects a particular book, a picture of the book cover will be displayed.  I've tried a bunch of different ways but nothing seems to work. I have thisGenreComboBox_SelectedIndexChanged so I guess it's a matter of the if/else if statement. Below is what I've been trying, I'm sure it's way way off.  Suggestions? Many thanks!</p>
  
  <pre><code>        //if ((string)thisGenreComboBox.SelectedItem == ("Networking"))
          //if (thisGenreComboBox.Text == "Networking")
          if (thisGenreComboBox.SelectedIndex == 1)
          {
              thisGenrePictureBox.Image = Image.FromFile(@"networkingcover.jpg");
          }
  </code></pre>
  
  <p><strong>* Edited *</strong></p>
  
  <p>Below is what I eventually came up with and works perfect for my needs.  Also, I applied the same to a ListBox and that works fine as well.</p>
  
  <pre><code>        switch (thisGenreComboBox.SelectedIndex)
          {
              case 0:
                  {
                      thisGenrePictureBox.ImageLocation = ("NetworkCover.jpg");
                      break;
                  }
              case 1:
                  {
                      thisGenrePictureBox.ImageLocation = ("ProgramCover.jpg");
                      break;
                  }
              case 2:
                  {
                      thisGenrePictureBox.ImageLocation = ("WebProgramCover.jpg");
                      break;
                  }
          }
  </code></pre>