- form should not appear after the 30 button_click
- private int counter = 0;
- ...
- counter++;
- var form2 = new Form2();
- form2.ShowDialog();
- ...
- ...
- if (counter < 30) {
- counter++;
- var form2 = new Form2();
- form2.ShowDialog();
- } else {
- MessageBox.Show("Sorry, Form2 has already been opened 30 times.");
- }
- ...
- static int count;
- if(++count <= 30)
- {
- //show it
- }
- else
- {
- //Do something else
- }