Why do I get a System.ArgumentOutOfRangeException: ''minValue' cannot be greater than maxValue. Parameter name: minValue' error? : <p>I've got an essential skills program which is very simple. The question is within the code. 
I want the question to be loaded from a text file. </p>

<p>I have already added some questions to the text file.</p>

<p>I have a list index where a random question will be picked from the text file and it will load as a label. </p>

<p>The issue is when I try to load the question I get a:
<strong>System.ArgumentOutOfRangeException: ''minValue' cannot be greater than maxValue. Parameter name: minValue' error</strong></p>

<p>Here is my code: </p>

<pre><code>        private void LoadQuestions()
    {
        if(Globals.intQuestionNumber == 11)
        {
            MessageBox.Show("Quiz complete - Redirecting", "Quiz Complete");

            var fileStream = new FileStream(@"H:\(4)Programming\Assignments\EssentialSkills - Optimised\EssentialSkills\Numeracy\QuestionsLvl0.txt", FileMode.Open, FileAccess.Read);
            using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
            {
                string line;
                while ((line = streamReader.ReadLine()) != null)
                {
                    stringAllInfo.Add(line);
                    MessageBox.Show(line);

                }
            }

            char[] delimiterChars = { ',' };

            foreach (string l in stringAllInfo)
            {
                string[] words = l.Split(delimiterChars);
                strQuestion.Add(words[0]);
                strAnswer.Add(words[1]);
                Console.WriteLine(words[0]);
                Console.WriteLine(words[1]);

            }


            Menus.Summary sum = new Menus.Summary();
            sum.Show();
            this.Hide();
        }

        else 
        {
            lblCountdownval.Visible = false;
            lblCountdown.Visible = false;

            Globals.intQuestionNumber += 0;
            lblQuestionsNumber.Text = "Question Number: " + Globals.intQuestionNumber.ToString();



            Random random = new Random();
            Globals.listIndex = random.Next(0, strAnswer.Count - 1);

            lblQuestion.Text = strQuestion.ElementAt(Globals.listIndex);

            Globals.listQuestonsAsked.Add(strQuestion.ElementAt(Globals.listIndex));
            btnCorrect.Text = strAnswer.ElementAt(Globals.listIndex).ToString();
            btnAnswer1.Text = random.Next(200).ToString();
            btnAnswer3.Text = random.Next(200).ToString();

            int locationIndex = random.Next(0, 3);
            btnCorrect.Location = points.ElementAt(locationIndex);

            locationIndex = random.Next(0, 3);

            btnAnswer1.Location = points.ElementAt(locationIndex);
            while ((btnAnswer1.Location == btnCorrect.Location))
            {
                locationIndex = random.Next(0, 3);
                btnAnswer1.Location = points.ElementAt(locationIndex);

            }
            locationIndex = random.Next(0, 3);
            btnAnswer3.Location = points.ElementAt(locationIndex);

            while ((btnAnswer3.Location == btnCorrect.Location) || (btnAnswer3.Location == btnAnswer1.Location))
            {
                locationIndex = random.Next(0, 3);
                btnAnswer3.Location = points.ElementAt(locationIndex);
            }

            btnAnswer1.Show();
            btnCorrect.BackColor = Color.White;
            btnAnswer3.Show();
        }

    }
</code></pre>

<p>and here are my Lists:</p>

<pre><code>    public List&lt;string&gt; strQuestion = new List&lt;string&gt;();
    public List&lt;string&gt; strAnswer = new List&lt;string&gt;();
    public List&lt;string&gt; stringAllInfo = new List&lt;string&gt;();
</code></pre>

<p>I want the question from the text file to a label but I get that error. </p>

<p>Any advice?</p>

<p>Thanks. </p>
