I have two forms, when I click a button on my first form it closes it and opens the 2nd form. However, when I click the default 'X' in the top right corner of the form to close it, it closes but the program's process are still left running in the background. How can I fix this to completely close the program as well?
1
Expert's answer
2016-12-04T03:56:12-0500
For default in windows forms in the situation that you cited above - when you close 2-nd form, process of the 1-st form will be also ended. Maybe you use Hide(), not Close(). But if you cant get it you can just write property of Owner, for example form1.Owner = form2; This means that when you close form 2 it will automatic close all like "child" forms for which is owner form2;
And the last - you can use FormClosed event and write all that you want for example Application.Exit(); - for exit from your program and closing all forms and processes.
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment