1.declare any global variable or flag where you can set that is there any changes happened or not. Its simple.
2. You have to check that variable's value on close button click. Here is the code to get that.
private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
if (string.Equals((sender as Button).Name, @"CloseButton"))
else
}
Source :
Click Here[
^]
3. Closing form and opening form.
Done.