I have a problem with my C# program: I have created a quiz with 10 questions and 10 images.
I get this Length cannot be less than zero.\r\nParameter name: length
at the line
int imageIndex = int.Parse(line.Substring(0, delimiter));
Even if in my notepad file I included the image index:
3:What is the foo in the bar?
10:How can you add a widget?
4:Why pick a bar over a foo?
Here is the code:
if (nr >= questions.Count)
{
button1.Enabled = false;
}
else
{
Random r = new Random();
int x;
do
{
x = r.Next(questions.Count);
}
while (questions[x].displayed == true);
textBox1.Text = questionText;
radioButton1.Text = questions[x].answer1;
radioButton2.Text = questions[x].answer2;
questions[x].displayed= true;
current_question = x;
}