我的C#程序出現問題:我創建了一個包含10個問題和10個圖像的測驗。 我得到這個Length cannot be less than zero.\r\nParameter name: length
在該行c#error:長度不能小於0
int imageIndex = int.Parse(line.Substring(0, delimiter));
即使在我的記事本文件,我包括在該圖像索引:
3:What is the foo in the bar?
10:How can you add a widget?
4:Why pick a bar over a foo?
下面是代碼:
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;
}
調用'Substring'時'delimiter'的值是多少? –
什麼??????????? –
什麼是分隔符? – Tilak