How to check if window is opened and close it
问题 I am working on C# winforms . I have function Validate() which is present in the CS file. When I call function Validate() it opens ErrorForm using ErrorForm ew = new ErrorForm(Errors); // Errors is list<string> ew.Show(); But when I call it again, a new window opens and my previous window is open too. I have to close that window manually. Is there any method available such that if I call validate() again, it will close the current ErrorForm and will open new ErrorForm . 回答1: try this one: var