How to close form

后端 未结 8 2129
南旧
南旧 2021-02-18 23:54

Ok, so a Windows Forms class, WindowSettings, and the form has a \"Cancel\"-button. When the user clicks the button, the dialog DialogSettingsCancel will pop-up up and ask the u

8条回答
  •  渐次进展
    2021-02-19 00:07

    new WindowSettings();
    

    You just closed a brand new instance of the form that wasn't visible in the first place.

    You need to close the original instance of the form by accepting it as a constructor parameter and storing it in a field.

提交回复
热议问题