-4
void GetTestQuestion()                               
{// this function will randomly choose question from question array and store into new   array named testQuestion
i = 0;
while (i < max)
{
Random();
if (question[num, 0] != string.Empty)
{
testQuestion[i, 0] = question[num, 0].ToString();
testQuestion[i, 1] = question[num, 1].ToString();
testQuestion[i, 2] = question[num, 2].ToString();
testQuestion[i, 3] = question[num, 3].ToString();
testQuestion[i, 4] = question[num, 4].ToString();
testQuestion[i, 5] = question[num, 5].ToString();
testQuestion[i, 6] = question[num, 6].ToString();
i++;
}            

}
}

protected void Button3_Click(object sender, EventArgs e)
{// this button is to show the question into listbox...
for (i = 0; i < max; i++)
{
ListBox1.Items.Add(testQuestion[i, 1].ToString());
}
}

首先,我会从 Question Array 中随机选择一个问题并存储到 testQuestion 数组中。但是,在我点击按钮后,我的 testQestion 数组变为空值……出了什么问题?

4

1 回答 1

0

您将 if 语句与什么进行比较,因为 if 语句中的代码就是它所实现的。所以它正在寻找这个:question[num, 0] 在要比较的语句之外!= string.Empty。

于 2013-10-24T20:54:03.340 回答