title: ArgumentOutOfRangeException while assigning from a list
body: <p>So basically after reforming one of my old questions like 20 million  times, I've finally figured out how to separate two of my variables apart and match them together, or at least I thought I had.</p>
  
  <p>My code basically takes from a list of 1s and 2s and then decides based on whether a one or a two was assigned, should the player get a picture that depicts something or a picture that depicts text, and accordingly, they are chosen from lists and tagged.</p>
  
  <p>However when I run my method for AssigningPicturesToPictureBoxes(), an ArgumentOutOfRangeException is thrown and I cannot understand why, because it doesn't occur whenever the integer list pictures is called, but it does cause a problem whenever the integer list texts is called. As both sets of code are practically identical, I cannot understand for the life of me what is wrong with them. I would really appreciate if someone could help me with this.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using System.IO;
  
  namespace BinaryFileReader
  {
      public partial class Form2 : Form
      {
          public Form2()
          {
              InitializeComponent();
  
              AssignTorPToPictureBoxes();
  
              AssignPicturesToPictureBoxes();
          }
  
          Random random = new Random();
  
              List&lt;int&gt; pictures = new List&lt;int&gt;() 
              { 
                  1,2,3,4,5,6,7,8
              };
  
              List&lt;int&gt; texts = new List&lt;int&gt;() 
              { 
                  1,2,3,4,5,6,7,8
              };
  
              List&lt;int&gt; TorP = new List&lt;int&gt;()
              {
                  1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2
              };
  
              private void AssignPicturesToPictureBoxes()
              {
                  foreach(Control Control in tableLayoutPanel1.Controls)
  
                  {
                      PictureBox picturebox = Control as PictureBox;
  
                      if (picturebox.Tag.ToString() == "1")
                      {
                          int randomNumber = random.Next(pictures.Count);
  
                          int unconvertedtag = pictures[randomNumber];
  
                          string convertedtag = unconvertedtag.ToString();
  
                          picturebox.Tag = convertedtag;
  
                          picturebox.Visible = false;
  
                          pictures.RemoveAt(randomNumber);
  
                          if (picturebox.Tag.ToString() == "1")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLSIGNA;
                          }
  
                          if (picturebox.Tag.ToString() == "2")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLSIGNBREAKFAST;
                          }
  
                          if (picturebox.Tag.ToString() == "3")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLSIGNCAR;
                          }
  
                          if (picturebox.Tag.ToString() == "4")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLSIGNCAT;
                          }
  
                          if (picturebox.Tag.ToString() == "5")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLSIGNCOFFEE;
                          }
  
                          if (picturebox.Tag.ToString() == "6")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLSIGNDOG;
                          }
  
                          if (picturebox.Tag.ToString() == "7")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLSIGNENGLAND;
                          }
  
                          if (picturebox.Tag.ToString() == "8")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLSIGNH;
                          }
  
                      }
  
                      if (picturebox.Tag.ToString() == "2")
                      {
                          int randomNumber = random.Next(texts.Count);
  
                          int unconvertedtag = texts[randomNumber];
  
                          string convertedtag = unconvertedtag.ToString();
  
                          picturebox.Tag = convertedtag;
  
                          picturebox.Visible = false;
  
                          texts.RemoveAt(randomNumber);
  
                          if (picturebox.Tag.ToString() == "1")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLTEXTA;
                          }
  
                          if (picturebox.Tag.ToString() == "2")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLTEXTBREAKFAST;
                          }
  
                          if (picturebox.Tag.ToString() == "3")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLTEXTCAR;
                          }
  
                          if (picturebox.Tag.ToString() == "4")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLTEXTCAT;
                          }
  
                          if (picturebox.Tag.ToString() == "5")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLTEXTCOFEE;
                          }
  
                          if (picturebox.Tag.ToString() == "6")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLTEXTDOG;
                          }
  
                          if (picturebox.Tag.ToString() == "7")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLTEXTENGLAND;
                          }
  
                          if (picturebox.Tag.ToString() == "8")
                          {
                              picturebox.Image = global::BinaryFileReader.Properties.Resources.BSLTEXTH;
                          }
                      }
  
  
  
                  }
  
              }
  
              private void AssignTorPToPictureBoxes()
              {
                  foreach (Control Control in tableLayoutPanel1.Controls)
                  {
                      PictureBox picturebox = Control as PictureBox;
                      if (picturebox != null)
                      {
                          int randomNumber = random.Next(TorP.Count);
                          int unconvertedtag = TorP[randomNumber];
                          string convertedtag = unconvertedtag.ToString();
                          picturebox.Tag = convertedtag;
                          TorP.RemoveAt(randomNumber);
  
                      }
                  }      
              }
  
              private void pictureBox1_Click(object sender, EventArgs e)
              {
                  PictureBox picturebox = sender as PictureBox;
  
                  if (picturebox != null)
                  {
  
                      if (picturebox.Visible == true)
                      {
                          return;
                      }
  
                      else
                      {
                          picturebox.Visible = true;
                      }
                  }
              }
      }
  }
  </code></pre>
  
  <p>On a side note, incase anyone is wondering the principle behind why I'm doing this, this is for a game, wherein the player clicks on a picturebox, and they click on another picturebox and attempt to match them together within a time limit, this is unfortunately the only part of the program that isn't working at the moment.</p>
  
  <p>EDIT: Sorry, I wasn't specific enough, I'll get only the specific sections up in  a sec</p>
  
  <p>EDIT2:
   The Error occurs specifically at the sections which says </p>
  
  <p><strong>int unconvertedtag = text[randomNumber];</strong></p>
  
  <pre><code>Random random = new Random();
  
          List&lt;int&gt; pictures = new List&lt;int&gt;() 
          { 
              1,2,3,4,5,6,7,8
          };
  
          List&lt;int&gt; texts = new List&lt;int&gt;() 
          { 
              1,2,3,4,5,6,7,8
          };
  
          List&lt;int&gt; TorP = new List&lt;int&gt;()
          {
              1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2
          };
  
          private void AssignPicturesToPictureBoxes()
          {
              foreach(Control Control in tableLayoutPanel1.Controls)
  
              {
                  PictureBox picturebox = Control as PictureBox;
  
                  if (picturebox.Tag.ToString() == "1")
                  {
                      int randomNumber = random.Next(pictures.Count);
  
                      int unconvertedtag = pictures[randomNumber];
  
                      string convertedtag = unconvertedtag.ToString();
  
                      picturebox.Tag = convertedtag;
  
                      picturebox.Visible = false;
  
                      pictures.RemoveAt(randomNumber);
                  }
  
                  if (picturebox.Tag.ToString() == "2")
                  {
                      int randomNumber = random.Next(texts.Count);
  
                      int unconvertedtag = texts[randomNumber];
  
                      string convertedtag = unconvertedtag.ToString();
  
                      picturebox.Tag = convertedtag;
  
                      picturebox.Visible = false;
  
                      texts.RemoveAt(randomNumber);
                  }
  </code></pre>