I have a textfile called answers.txt. In this textfile I have stated a few answers like this:
answer1 | answer2 | answer3 |...
Now to read these answers I made a class called answeres and it contains this code:
public String getAnswer(int number)
{
stream = File.OpenText("answers.txt");
String[] answers;
string line = stream.ReadLine();
vragen = line.Split('|');
return answers[number];
}
In my mainForm where I need to get these text's displayed I have 4 Labels. I want these labels to show these answers in random order. I did it like this:
public form1()
{
InitializeComponent();
}
private answer answer1 = new answer();
private int rand = 0;
private void form1_Load(object sender, EventArgs e)
{
label1.Text = answer1.getAnswer(rand); }
Now this isn't random (which I would like) & also this only works for one Label. How can I display the textfile on the multiple labels at random while making sure none of the labels show the same text from the textfile?
Thanks in advance.