Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. list<int> listName = new list<int>();
  2.  
  3. for(int i; i <= listName[0];i++)
  4. {
  5. button(i).Enabled = false;
  6. }
  7.  
  8. List<Button> buttonsToDisable = new List<Button>()
  9. {
  10. button1,
  11. button2
  12. };
  13.  
  14. foreach (var button in buttonsToDisable)
  15. {
  16. button.Enabled = false;
  17. }
  18.  
  19. foreach(var button in groupBox1.Controls.OfType<Button>())
  20. {
  21. button.Enabled = false;
  22. }
  23.  
  24. List<int> buttonSubfixId = new List<int>()
  25. {
  26. 1,
  27. 2
  28. };
  29.  
  30. foreach (var id in buttonSubfixId)
  31. {
  32. var controls = this.Controls.Find("button" + id.ToString(), true).OfType<Button>();
  33.  
  34. if (controls.Count()>0)
  35. {
  36. foreach (var button in controls)
  37. {
  38. button.Enabled = false;
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement