Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 22nd, 2012  |  syntax: None  |  size: 0.41 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. form should not appear after the 30 button_click
  2. private int counter = 0;
  3.        
  4. ...
  5. counter++;
  6. var form2 = new Form2();
  7. form2.ShowDialog();
  8. ...
  9.        
  10. ...
  11. if (counter < 30) {
  12.     counter++;
  13.     var form2 = new Form2();
  14.     form2.ShowDialog();
  15. } else {
  16.     MessageBox.Show("Sorry, Form2 has already been opened 30 times.");
  17. }
  18. ...
  19.        
  20. static int count;
  21.        
  22. if(++count <= 30)
  23. {
  24.     //show it
  25. }
  26. else
  27. {
  28.     //Do something else
  29. }