Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Button[] buttons = new Button[3];
- int questionNumber = 0;
- int qNumber = 0;
- int x = 1;
- Random r = new Random();
- List<Button> listOfButtons = new List<Button>();
- listOfButtons.Add(buttons[0]);
- listOfButtons.Add(buttons[1]);
- listOfButtons.Add(buttons[2]);
- int rIndex;
- while (qNumber < 3)
- {
- rIndex = r.Next(0, listOfButtons.Count); //Choose a random object from list
- listOfButtons[rIndex].Text = qAnswer[questionNumber, x++]; // adds text to button
- listOfButtons.Remove(buttons[rIndex]); // removes button from index
- qNumber++;
- }
- private void EasyLevel_Load(object sender, EventArgs e)
- {
- buttons[0] = a1; // a1 is button
- buttons[1] = a2;
- buttons[2] = a3;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement