Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. Button[] buttons = new Button[3];
  2. int questionNumber = 0;
  3. int qNumber = 0;
  4. int x = 1;
  5.  
  6.  
  7. Random r = new Random();
  8. List<Button> listOfButtons = new List<Button>();
  9. listOfButtons.Add(buttons[0]);
  10. listOfButtons.Add(buttons[1]);
  11. listOfButtons.Add(buttons[2]);
  12.  
  13.  
  14.  
  15. int rIndex;
  16.  
  17. while (qNumber < 3)
  18. {
  19. rIndex = r.Next(0, listOfButtons.Count); //Choose a random object from list
  20. listOfButtons[rIndex].Text = qAnswer[questionNumber, x++]; // adds text to button
  21. listOfButtons.Remove(buttons[rIndex]); // removes button from index
  22. qNumber++;
  23.  
  24.  
  25. }
  26.  
  27.  
  28.  
  29. private void EasyLevel_Load(object sender, EventArgs e)
  30. {
  31. buttons[0] = a1; // a1 is button
  32. buttons[1] = a2;
  33. buttons[2] = a3;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement