It is necessary that after pressing the "close" button, the program executes the code. I found a solution to this problem.
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; int i = 0; while(i < 10) { Form1 msf = new Form1(); msf.Show(); } } But this code does not work. How to fix this code to make it work?

