Hi Subbu,
I have created sample code for you, please modify your code according this.
This code is very SIMPLE and FAST to pickup random question from list of questions.
ArrayList availableQuestions = new ArrayList();
ArrayList completedQuestions = new ArrayList();
public Form1()
{
InitializeComponent();
for (int i = 1; i <= 10; i++)
{
availableQuestions.Add(i);
}
}
private void button1_Click(object sender, EventArgs e)
{
GetRandomNumber();
}
private void GetRandomNumber()
{
if (availableQuestions.Count >= 1)
{
Random rand = new Random();
int QuestionID = Convert.ToInt16(availableQuestions[rand.Next(0, availableQuestions.Count - 1)]);
completedQuestions.Add(QuestionID);
availableQuestions.Remove(QuestionID);
}
}
Please do let me know, if you have any doubt for the same.
Thanks,
Imdadhusen